home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Games / Mac Game Developer's Handbook / Compatibility / Compatibility Why and How < prev    next >
MacBinary  |  1993-04-21  |  168.3 KB  |  [ONLN/HLX2]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
100% file MacBinary II, inited, Wed Apr 21 17:33:25 1993, modified Wed Apr 21 17:33:37 1993, creator 'HLX2', type 'ONLN', 169338 bytes "Compatibility Why and How" , at 0x295fa 2746 bytes resource default (weak)
99% file data default
100% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[ONLN]
macFileCreator[HLX2]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 19 43 6f 6d 70 61 74 | 69 62 69 6c 69 74 79 20 |..Compat|ibility |
|00000010| 57 68 79 20 61 6e 64 20 | 48 6f 77 00 00 00 00 00 |Why and |How.....|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......|
|00000050| 00 00 00 00 02 95 7a 00 | 00 0a ba a7 fb 6e 25 a7 |......z.|.....n%.|
|00000060| fb 6e 31 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.n1.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 aa 1a 00 00 |........|........|
|00000080| 43 6f 6d 70 61 74 69 62 | 69 6c 69 74 79 3a 20 57 |Compatib|ility: W|
|00000090| 68 79 20 26 20 48 6f 77 | 0d 4f 76 65 72 76 69 65 |hy & How|.Overvie|
|000000a0| 77 09 4d 2e 4f 56 2e 43 | 6f 6d 70 61 74 69 62 69 |w.M.OV.C|ompatibi|
|000000b0| 6c 69 74 79 57 68 79 0d | 52 65 76 69 73 65 64 20 |lityWhy.|Revised |
|000000c0| 62 79 3a 09 09 4d 61 72 | 63 68 20 31 39 38 38 0d |by:..Mar|ch 1988.|
|000000d0| 57 72 69 74 74 65 6e 20 | 62 79 3a 09 42 6f 62 20 |Written |by:.Bob |
|000000e0| 4a 6f 68 6e 73 6f 6e 09 | 46 65 62 72 75 61 72 79 |Johnson.|February|
|000000f0| 20 31 39 38 37 0d 57 68 | 69 6c 65 20 63 72 65 61 | 1987.Wh|ile crea|
|00000100| 74 69 6e 67 20 6f 72 20 | 72 65 76 69 73 69 6e 67 |ting or |revising|
|00000110| 20 61 6e 79 20 70 72 6f | 67 72 61 6d 20 66 6f 72 | any pro|gram for|
|00000120| 20 74 68 65 20 4d 61 63 | 69 6e 74 6f 73 68 2c 20 | the Mac|intosh, |
|00000130| 79 6f 75 20 73 68 6f 75 | 6c 64 20 62 65 20 61 77 |you shou|ld be aw|
|00000140| 61 72 65 20 6f 66 20 74 | 68 65 20 6d 6f 73 74 20 |are of t|he most |
|00000150| 63 6f 6d 6d 6f 6e 20 72 | 65 61 73 6f 6e 73 20 77 |common r|easons w|
|00000160| 68 79 20 70 72 6f 67 72 | 61 6d 73 20 66 61 69 6c |hy progr|ams fail|
|00000170| 20 6f 6e 20 76 61 72 69 | 6f 75 73 20 76 65 72 73 | on vari|ous vers|
|00000180| 69 6f 6e 73 20 6f 66 20 | 74 68 65 20 4d 61 63 69 |ions of |the Maci|
|00000190| 6e 74 6f 73 68 2e 20 54 | 68 69 73 20 6e 6f 74 65 |ntosh. T|his note|
|000001a0| 20 77 69 6c 6c 20 64 65 | 74 61 69 6c 20 73 6f 6d | will de|tail som|
|000001b0| 65 20 63 6f 6d 6d 6f 6e | 20 66 61 69 6c 75 72 65 |e common| failure|
|000001c0| 20 6d 6f 64 65 73 2c 20 | 77 68 79 20 74 68 65 79 | modes, |why they|
|000001d0| 20 6f 63 63 75 72 2c 20 | 61 6e 64 20 68 6f 77 20 | occur, |and how |
|000001e0| 74 6f 20 61 76 6f 69 64 | 20 74 68 65 6d 2e 0d 57 |to avoid| them..W|
|000001f0| 65 d5 76 65 20 74 72 69 | 65 64 20 74 6f 20 65 78 |e.ve tri|ed to ex|
|00000200| 70 6c 61 69 6e 20 74 68 | 65 20 69 73 73 75 65 73 |plain th|e issues|
|00000210| 20 69 6e 20 64 65 70 74 | 68 2c 20 62 75 74 20 72 | in dept|h, but r|
|00000220| 65 63 6f 67 6e 69 7a 65 | 20 74 68 61 74 20 6e 6f |ecognize| that no|
|00000230| 74 20 65 76 65 72 79 6f | 6e 65 20 69 73 20 69 6e |t everyo|ne is in|
|00000240| 74 65 72 65 73 74 65 64 | 20 69 6e 20 65 76 65 72 |terested| in ever|
|00000250| 79 20 69 73 73 75 65 2e | 20 46 6f 72 20 65 78 61 |y issue.| For exa|
|00000260| 6d 70 6c 65 2c 20 69 66 | 20 79 6f 75 72 20 61 70 |mple, if| your ap|
|00000270| 70 6c 69 63 61 74 69 6f | 6e 20 69 73 20 6e 6f 74 |plicatio|n is not|
|00000280| 20 63 6f 70 79 20 70 72 | 6f 74 65 63 74 65 64 2c | copy pr|otected,|
|00000290| 20 79 6f 75 d5 72 65 20 | 70 72 6f 62 61 62 6c 79 | you.re |probably|
|000002a0| 20 6e 6f 74 20 76 65 72 | 79 20 69 6e 74 65 72 65 | not ver|y intere|
|000002b0| 73 74 65 64 20 69 6e 20 | 74 68 65 20 73 65 63 74 |sted in |the sect|
|000002c0| 69 6f 6e 20 6f 6e 20 63 | 6f 70 79 20 70 72 6f 74 |ion on c|opy prot|
|000002d0| 65 63 74 69 6f 6e 2e 20 | 54 68 61 74 d5 73 20 77 |ection. |That.s w|
|000002e0| 68 79 20 77 65 d5 76 65 | 20 69 6e 63 6c 75 64 65 |hy we.ve| include|
|000002f0| 64 20 74 68 65 20 6f 75 | 74 6c 69 6e 65 20 66 6f |d the ou|tline fo|
|00000300| 72 6d 20 6f 66 20 74 68 | 65 20 74 65 63 68 6e 69 |rm of th|e techni|
|00000310| 63 61 6c 20 6e 6f 74 65 | 2e 20 54 68 65 20 66 69 |cal note|. The fi|
|00000320| 72 73 74 20 74 77 6f 20 | 70 61 67 65 73 20 6f 75 |rst two |pages ou|
|00000330| 74 6c 69 6e 65 20 74 68 | 65 20 70 72 6f 62 6c 65 |tline th|e proble|
|00000340| 6d 73 20 61 6e 64 20 74 | 68 65 20 73 6f 6c 75 74 |ms and t|he solut|
|00000350| 69 6f 6e 73 20 74 68 61 | 74 20 61 72 65 20 64 65 |ions tha|t are de|
|00000360| 74 61 69 6c 65 64 20 6c | 61 74 65 72 2e 20 46 65 |tailed l|ater. Fe|
|00000370| 65 6c 20 66 72 65 65 20 | 74 6f 20 73 6b 69 70 20 |el free |to skip |
|00000380| 61 72 6f 75 6e 64 20 61 | 74 20 77 69 6c 6c 2c 20 |around a|t will, |
|00000390| 62 75 74 20 72 65 6d 65 | 6d 62 65 72 20 74 68 61 |but reme|mber tha|
|000003a0| 74 20 77 65 d5 72 65 20 | 73 65 6e 64 69 6e 67 20 |t we.re |sending |
|000003b0| 74 68 69 73 20 65 6e 6f | 72 6d 6f 75 73 20 74 65 |this eno|rmous te|
|000003c0| 63 68 6e 69 63 61 6c 20 | 6e 6f 74 65 20 62 65 63 |chnical |note bec|
|000003d0| 61 75 73 65 20 74 68 65 | 20 73 75 67 67 65 73 74 |ause the| suggest|
|000003e0| 69 6f 6e 73 20 69 74 20 | 70 72 6f 76 69 64 65 73 |ions it |provides|
|000003f0| 20 6d 61 79 20 73 61 76 | 65 20 79 6f 75 20 68 61 | may sav|e you ha|
|00000400| 73 74 79 20 63 6f 6d 70 | 61 74 69 62 69 6c 69 74 |sty comp|atibilit|
|00000410| 79 20 72 65 76 69 73 69 | 6f 6e 73 20 77 68 65 6e |y revisi|ons when|
|00000420| 20 77 65 20 61 6e 6e 6f | 75 6e 63 65 20 61 20 6e | we anno|unce a n|
|00000430| 65 77 20 6d 61 63 68 69 | 6e 65 2e 0d 57 65 20 6b |ew machi|ne..We k|
|00000440| 6e 6f 77 20 69 74 d5 73 | 20 61 20 6c 6f 74 2c 20 |now it.s| a lot, |
|00000450| 61 6e 64 20 77 65 d5 72 | 65 20 68 65 72 65 20 74 |and we.r|e here t|
|00000460| 6f 20 68 65 6c 70 20 79 | 6f 75 20 69 66 20 79 6f |o help y|ou if yo|
|00000470| 75 20 6e 65 65 64 20 69 | 74 2e 20 4f 75 72 20 61 |u need i|t. Our a|
|00000480| 64 64 72 65 73 73 20 28 | 65 6c 65 63 74 72 6f 6e |ddress (|electron|
|00000490| 69 63 20 61 6e 64 20 70 | 68 79 73 69 63 61 6c 29 |ic and p|hysical)|
|000004a0| 20 69 73 20 6f 6e 20 70 | 61 67 65 20 74 68 72 65 | is on p|age thre|
|000004b0| 65 d1 63 6f 6e 74 61 63 | 74 20 75 73 20 77 69 74 |e.contac|t us wit|
|000004c0| 68 20 61 6e 79 20 71 75 | 65 73 74 69 6f 6e 73 d1 |h any qu|estions.|
|000004d0| 74 68 61 74 d5 73 20 77 | 68 61 74 20 77 65 d5 72 |that.s w|hat we.r|
|000004e0| 65 20 68 65 72 65 20 66 | 6f 72 21 0d 43 6f 6d 70 |e here f|or!.Comp|
|000004f0| 61 74 69 62 69 6c 69 74 | 79 3a 20 74 68 65 20 6f |atibilit|y: the o|
|00000500| 75 74 6c 69 6e 65 0d 44 | 6f 6e d5 74 20 61 73 73 |utline.D|on.t ass|
|00000510| 75 6d 65 20 74 68 65 20 | 73 63 72 65 65 6e 20 69 |ume the |screen i|
|00000520| 73 20 61 20 66 69 78 65 | 64 20 73 69 7a 65 0d 54 |s a fixe|d size.T|
|00000530| 6f 20 67 65 74 20 74 68 | 65 20 73 63 72 65 65 6e |o get th|e screen|
|00000540| 20 73 69 7a 65 3a 0d 09 | a5 20 63 68 65 63 6b 20 | size:..|. check |
|00000550| 74 68 65 20 51 75 69 63 | 6b 44 72 61 77 20 67 6c |the Quic|kDraw gl|
|00000560| 6f 62 61 6c 20 73 63 72 | 65 65 6e 42 69 74 73 2e |obal scr|eenBits.|
|00000570| 62 6f 75 6e 64 73 0d 44 | 6f 6e d5 74 20 61 73 73 |bounds.D|on.t ass|
|00000580| 75 6d 65 20 74 68 65 20 | 73 63 72 65 65 6e 20 69 |ume the |screen i|
|00000590| 73 20 69 6e 20 61 20 66 | 69 78 65 64 20 6c 6f 63 |s in a f|ixed loc|
|000005a0| 61 74 69 6f 6e 0d 54 6f | 20 67 65 74 20 74 68 65 |ation.To| get the|
|000005b0| 20 73 63 72 65 65 6e 20 | 6c 6f 63 61 74 69 6f 6e | screen |location|
|000005c0| 3a 0d 09 a5 20 63 68 65 | 63 6b 20 74 68 65 20 51 |:... che|ck the Q|
|000005d0| 75 69 63 6b 44 72 61 77 | 20 67 6c 6f 62 61 6c 20 |uickDraw| global |
|000005e0| 73 63 72 65 65 6e 42 69 | 74 73 2e 62 61 73 65 41 |screenBi|ts.baseA|
|000005f0| 64 64 72 0d 44 6f 6e d5 | 74 20 61 73 73 75 6d 65 |ddr.Don.|t assume|
|00000600| 20 74 68 61 74 20 72 6f | 77 42 79 74 65 73 20 69 | that ro|wBytes i|
|00000610| 73 20 65 71 75 61 6c 20 | 74 6f 20 74 68 65 20 77 |s equal |to the w|
|00000620| 69 64 74 68 20 6f 66 20 | 74 68 65 20 73 63 72 65 |idth of |the scre|
|00000630| 65 6e 0d 54 6f 20 67 65 | 74 20 74 68 65 20 6e 75 |en.To ge|t the nu|
|00000640| 6d 62 65 72 20 6f 66 20 | 62 79 74 65 73 20 6f 6e |mber of |bytes on|
|00000650| 20 61 20 6c 69 6e 65 3a | 0d 09 a5 20 63 68 65 63 | a line:|... chec|
|00000660| 6b 20 74 68 65 20 51 75 | 69 63 6b 44 72 61 77 20 |k the Qu|ickDraw |
|00000670| 67 6c 6f 62 61 6c 20 73 | 63 72 65 65 6e 42 69 74 |global s|creenBit|
|00000680| 73 2e 72 6f 77 42 79 74 | 65 73 0d 54 6f 20 67 65 |s.rowByt|es.To ge|
|00000690| 74 20 74 68 65 20 73 63 | 72 65 65 6e 20 77 69 64 |t the sc|reen wid|
|000006a0| 74 68 3a 0d 09 a5 20 63 | 68 65 63 6b 20 74 68 65 |th:... c|heck the|
|000006b0| 20 51 75 69 63 6b 44 72 | 61 77 20 67 6c 6f 62 61 | QuickDr|aw globa|
|000006c0| 6c 20 73 63 72 65 65 6e | 42 69 74 73 2e 62 6f 75 |l screen|Bits.bou|
|000006d0| 6e 64 73 2e 72 69 67 68 | 74 0d 54 6f 20 64 6f 20 |nds.righ|t.To do |
|000006e0| 73 63 72 65 65 6e 2d 73 | 69 7a 65 20 63 61 6c 63 |screen-s|ize calc|
|000006f0| 75 6c 61 74 69 6f 6e 73 | 3a 0d 09 a5 20 55 73 65 |ulations|:... Use|
|00000700| 20 4c 6f 6e 67 49 6e 74 | 73 0d 44 6f 6e d5 74 20 | LongInt|s.Don.t |
|00000710| 77 72 69 74 65 20 74 6f | 20 6f 72 20 72 65 61 64 |write to| or read|
|00000720| 20 66 72 6f 6d 20 6e 69 | 6c 20 48 61 6e 64 6c 65 | from ni|l Handle|
|00000730| 73 20 6f 72 20 6e 69 6c | 20 50 6f 69 6e 74 65 72 |s or nil| Pointer|
|00000740| 73 0d 44 6f 6e d5 74 20 | 63 72 65 61 74 65 20 6f |s.Don.t |create o|
|00000750| 72 20 55 73 65 20 46 61 | 6b 65 20 48 61 6e 64 6c |r Use Fa|ke Handl|
|00000760| 65 73 0d 54 6f 20 61 76 | 6f 69 64 20 63 72 65 61 |es.To av|oid crea|
|00000770| 74 69 6e 67 20 6f 72 20 | 75 73 69 6e 67 20 66 61 |ting or |using fa|
|00000780| 6b 65 20 68 61 6e 64 6c | 65 73 3a 0d 09 a5 20 41 |ke handl|es:... A|
|00000790| 6c 77 61 79 73 20 6c 65 | 74 20 74 68 65 20 4d 65 |lways le|t the Me|
|000007a0| 6d 6f 72 79 20 4d 61 6e | 61 67 65 72 20 70 65 72 |mory Man|ager per|
|000007b0| 66 6f 72 6d 20 6f 70 65 | 72 61 74 69 6f 6e 73 20 |form ope|rations |
|000007c0| 77 69 74 68 20 68 61 6e | 64 6c 65 73 0d 09 a5 20 |with han|dles... |
|000007d0| 4e 65 76 65 72 20 77 72 | 69 74 65 20 63 6f 64 65 |Never wr|ite code|
|000007e0| 20 74 68 61 74 20 61 73 | 73 69 67 6e 73 20 73 6f | that as|signs so|
|000007f0| 6d 65 74 68 69 6e 67 20 | 74 6f 20 61 20 6d 61 73 |mething |to a mas|
|00000800| 74 65 72 20 70 6f 69 6e | 74 65 72 0d 44 6f 6e d5 |ter poin|ter.Don.|
|00000810| 74 20 77 72 69 74 65 20 | 63 6f 64 65 20 74 68 61 |t write |code tha|
|00000820| 74 20 6d 6f 64 69 66 69 | 65 73 20 69 74 73 65 6c |t modifi|es itsel|
|00000830| 66 0d 53 65 6c 66 20 6d | 6f 64 69 66 79 69 6e 67 |f.Self m|odifying|
|00000840| 20 63 6f 64 65 20 77 69 | 6c 6c 20 6e 6f 74 20 6c | code wi|ll not l|
|00000850| 69 76 65 20 61 63 72 6f | 73 73 20 69 6e 63 61 72 |ive acro|ss incar|
|00000860| 6e 61 74 69 6f 6e 73 20 | 6f 66 20 74 68 65 20 36 |nations |of the 6|
|00000870| 38 30 30 30 0d 54 68 69 | 6e 6b 20 63 61 72 65 66 |8000.Thi|nk caref|
|00000880| 75 6c 6c 79 20 61 62 6f | 75 74 20 63 6f 64 65 20 |ully abo|ut code |
|00000890| 64 65 73 69 67 6e 65 64 | 20 73 74 72 69 63 74 6c |designed| strictl|
|000008a0| 79 20 61 73 20 63 6f 70 | 79 20 70 72 6f 74 65 63 |y as cop|y protec|
|000008b0| 74 69 6f 6e 0d 54 6f 20 | 61 76 6f 69 64 20 63 6f |tion.To |avoid co|
|000008c0| 70 79 20 70 72 6f 74 65 | 63 74 69 6f 6e 2d 72 65 |py prote|ction-re|
|000008d0| 6c 61 74 65 64 20 69 6e | 63 6f 6d 70 61 74 69 62 |lated in|compatib|
|000008e0| 69 6c 69 74 69 65 73 3a | 0d 09 a5 20 41 76 6f 69 |ilities:|... Avoi|
|000008f0| 64 20 63 6f 70 79 20 70 | 72 6f 74 65 63 74 69 6f |d copy p|rotectio|
|00000900| 6e 20 61 6c 74 6f 67 65 | 74 68 65 72 0d 09 a5 20 |n altoge|ther... |
|00000910| 52 65 6c 79 20 6f 6e 20 | 73 63 68 65 6d 65 73 20 |Rely on |schemes |
|00000920| 74 68 61 74 20 64 6f 6e | d5 74 20 72 65 71 75 69 |that don|.t requi|
|00000930| 72 65 20 73 70 65 63 69 | 66 69 63 20 68 61 72 64 |re speci|fic hard|
|00000940| 77 61 72 65 0d 09 a5 20 | 4d 61 6b 65 20 73 75 72 |ware... |Make sur|
|00000950| 65 20 79 6f 75 72 20 73 | 63 68 65 6d 65 20 64 6f |e your s|cheme do|
|00000960| 65 73 6e d5 74 20 70 65 | 72 66 6f 72 6d 20 69 6c |esn.t pe|rform il|
|00000970| 6c 65 67 61 6c 20 6f 70 | 65 72 61 74 69 6f 6e 73 |legal op|erations|
|00000980| 20 0d 44 6f 6e d5 74 20 | 69 67 6e 6f 72 65 20 65 | .Don.t |ignore e|
|00000990| 72 72 6f 72 73 0d 54 6f | 20 67 65 74 20 76 61 6c |rrors.To| get val|
|000009a0| 75 61 62 6c 65 20 69 6e | 66 6f 72 6d 61 74 69 6f |uable in|formatio|
|000009b0| 6e 3a 0d 09 a5 20 43 68 | 65 63 6b 20 61 6c 6c 20 |n:... Ch|eck all |
|000009c0| 70 65 72 74 69 6e 65 6e | 74 20 63 61 6c 6c 73 20 |pertinen|t calls |
|000009d0| 66 6f 72 20 65 72 72 6f | 72 73 20 0d 09 a5 20 41 |for erro|rs ... A|
|000009e0| 6c 77 61 79 73 20 77 72 | 69 74 65 20 64 65 66 65 |lways wr|ite defe|
|000009f0| 6e 73 69 76 65 20 63 6f | 64 65 20 0d 44 6f 6e d5 |nsive co|de .Don.|
|00000a00| 74 20 61 63 63 65 73 73 | 20 68 61 72 64 77 61 72 |t access| hardwar|
|00000a10| 65 20 64 69 72 65 63 74 | 6c 79 0d 54 6f 20 61 76 |e direct|ly.To av|
|00000a20| 6f 69 64 20 68 61 72 64 | 77 61 72 65 2d 72 65 6c |oid hard|ware-rel|
|00000a30| 61 74 65 64 20 69 6e 63 | 6f 6d 70 61 74 69 62 69 |ated inc|ompatibi|
|00000a40| 6c 69 74 69 65 73 3a 0d | 09 a5 20 44 6f 6e d5 74 |lities:.|.. Don.t|
|00000a50| 20 72 65 61 64 20 6f 72 | 20 77 72 69 74 65 20 74 | read or| write t|
|00000a60| 68 65 20 68 61 72 64 77 | 61 72 65 0d 09 a5 20 49 |he hardw|are... I|
|00000a70| 66 20 79 6f 75 20 63 61 | 6e d5 74 20 67 65 74 20 |f you ca|n.t get |
|00000a80| 74 68 65 20 73 75 70 70 | 6f 72 74 20 66 72 6f 6d |the supp|ort from|
|00000a90| 20 74 68 65 20 52 4f 4d | 2c 20 61 73 6b 20 74 68 | the ROM|, ask th|
|00000aa0| 65 20 73 79 73 74 65 6d | 20 77 68 65 72 65 20 74 |e system| where t|
|00000ab0| 68 65 20 68 61 72 64 77 | 61 72 65 20 69 73 0d 09 |he hardw|are is..|
|00000ac0| a5 20 55 73 65 20 6c 6f | 77 2d 6d 65 6d 6f 72 79 |. Use lo|w-memory|
|00000ad0| 20 67 6c 6f 62 61 6c 73 | 0d 44 6f 6e d5 74 20 75 | globals|.Don.t u|
|00000ae0| 73 65 20 62 69 74 73 20 | 74 68 61 74 20 61 72 65 |se bits |that are|
|00000af0| 20 72 65 73 65 72 76 65 | 64 0d 54 6f 20 61 76 6f | reserve|d.To avo|
|00000b00| 69 64 20 63 6f 6d 70 61 | 74 69 62 69 6c 69 74 79 |id compa|tibility|
|00000b10| 20 70 72 6f 62 6c 65 6d | 73 20 77 68 65 6e 20 62 | problem|s when b|
|00000b20| 69 74 20 73 74 61 74 75 | 73 20 63 68 61 6e 67 65 |it statu|s change|
|00000b30| 73 3a 0d 09 a5 20 44 6f | 6e d5 74 20 75 73 65 20 |s:... Do|n.t use |
|00000b40| 75 6e 64 6f 63 75 6d 65 | 6e 74 65 64 20 73 74 75 |undocume|nted stu|
|00000b50| 66 66 0d 09 a5 20 57 68 | 65 6e 20 75 73 69 6e 67 |ff... Wh|en using|
|00000b60| 20 6c 6f 77 2d 6d 65 6d | 6f 72 79 20 67 6c 6f 62 | low-mem|ory glob|
|00000b70| 61 6c 73 2c 20 63 68 65 | 63 6b 20 6f 6e 6c 79 20 |als, che|ck only |
|00000b80| 77 68 61 74 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |what you| want to|
|00000b90| 20 6b 6e 6f 77 0d 53 75 | 6d 6d 61 72 79 0d 4d 69 | know.Su|mmary.Mi|
|00000ba0| 6e 6f 72 20 62 75 67 73 | 20 61 72 65 20 67 65 74 |nor bugs| are get|
|00000bb0| 74 69 6e 67 20 68 61 72 | 64 65 72 20 61 6e 64 20 |ting har|der and |
|00000bc0| 68 61 72 64 65 72 20 74 | 6f 20 67 65 74 20 61 77 |harder t|o get aw|
|00000bd0| 61 79 20 77 69 74 68 3a | 0d 09 a5 09 47 6f 6f 64 |ay with:|....Good|
|00000be0| 20 6c 75 63 6b 0d 09 a5 | 09 57 65 d5 6c 6c 20 68 | luck...|.We.ll h|
|00000bf0| 65 6c 70 0d 09 a5 09 41 | 70 70 6c 65 4c 69 6e 6b |elp....A|ppleLink|
|00000c00| 3a 20 4d 61 63 44 54 53 | 2c 20 4d 43 49 3a 20 4d |: MacDTS|, MCI: M|
|00000c10| 61 63 44 54 53 0d 09 a5 | 09 55 2e 53 2e 20 4d 61 |acDTS...|.U.S. Ma|
|00000c20| 69 6c 3a 20 32 30 35 32 | 35 20 4d 61 72 69 61 6e |il: 2052|5 Marian|
|00000c30| 69 20 41 76 65 2e 3b 20 | 4d 2f 53 20 32 37 2d 54 |i Ave.; |M/S 27-T|
|00000c40| 3b 20 43 75 70 65 72 74 | 69 6e 6f 2c 20 43 41 20 |; Cupert|ino, CA |
|00000c50| 39 35 30 31 34 0d 57 68 | 61 74 20 69 74 20 49 73 |95014.Wh|at it Is|
|00000c60| 0d 54 68 65 20 62 61 73 | 69 63 20 69 64 65 61 20 |.The bas|ic idea |
|00000c70| 69 73 20 74 6f 20 6d 61 | 6b 65 20 73 75 72 65 20 |is to ma|ke sure |
|00000c80| 74 68 61 74 20 79 6f 75 | 72 20 70 72 6f 67 72 61 |that you|r progra|
|00000c90| 6d 73 20 77 69 6c 6c 20 | 72 75 6e 2c 20 72 65 67 |ms will |run, reg|
|00000ca0| 61 72 64 6c 65 73 73 20 | 6f 66 20 77 68 69 63 68 |ardless |of which|
|00000cb0| 20 4d 61 63 69 6e 74 6f | 73 68 20 74 68 65 79 20 | Macinto|sh they |
|00000cc0| 61 72 65 20 62 65 69 6e | 67 20 72 75 6e 20 6f 6e |are bein|g run on|
|00000cd0| 2e 20 54 68 65 20 63 75 | 72 72 65 6e 74 20 73 79 |. The cu|rrent sy|
|00000ce0| 73 74 65 6d 73 20 74 6f | 20 62 65 20 63 6f 6e 63 |stems to| be conc|
|00000cf0| 65 72 6e 65 64 20 77 69 | 74 68 20 69 6e 63 6c 75 |erned wi|th inclu|
|00000d00| 64 65 3a 0d 09 a5 20 4d | 61 63 69 6e 74 6f 73 68 |de:... M|acintosh|
|00000d10| 20 31 32 38 4b 09 a5 20 | 4d 61 63 69 6e 74 6f 73 | 128K.. |Macintos|
|00000d20| 68 20 35 31 32 4b 65 0d | 09 a5 20 4d 61 63 69 6e |h 512Ke.|.. Macin|
|00000d30| 74 6f 73 68 20 35 31 32 | 4b 09 a5 20 4d 61 63 69 |tosh 512|K.. Maci|
|00000d40| 6e 74 6f 73 68 20 50 6c | 75 73 0d 09 a5 20 4d 61 |ntosh Pl|us... Ma|
|00000d50| 63 69 6e 74 6f 73 68 20 | 58 4c 09 a5 20 4d 61 63 |cintosh |XL.. Mac|
|00000d60| 69 6e 74 6f 73 68 20 53 | 45 0d 09 a5 20 4d 61 63 |intosh S|E... Mac|
|00000d70| 69 6e 74 6f 73 68 20 49 | 49 0d 49 66 20 79 6f 75 |intosh I|I.If you|
|00000d80| 20 70 65 72 66 6f 72 6d | 20 6f 70 65 72 61 74 69 | perform| operati|
|00000d90| 6f 6e 73 20 69 6e 20 61 | 20 67 65 6e 65 72 69 63 |ons in a| generic|
|00000da0| 20 66 61 73 68 69 6f 6e | 2c 20 74 68 65 72 65 20 | fashion|, there |
|00000db0| 69 73 20 72 61 72 65 6c | 79 20 61 6e 79 20 72 65 |is rarel|y any re|
|00000dc0| 61 73 6f 6e 20 74 6f 20 | 6b 6e 6f 77 20 77 68 61 |ason to |know wha|
|00000dd0| 74 20 6d 61 63 68 69 6e | 65 20 69 73 20 72 75 6e |t machin|e is run|
|00000de0| 6e 69 6e 67 2e 20 54 68 | 69 73 20 6d 65 61 6e 73 |ning. Th|is means|
|00000df0| 20 74 68 61 74 20 79 6f | 75 20 73 68 6f 75 6c 64 | that yo|u should|
|00000e00| 20 61 76 6f 69 64 20 77 | 72 69 74 69 6e 67 20 63 | avoid w|riting c|
|00000e10| 6f 64 65 20 74 6f 20 64 | 65 74 65 72 6d 69 6e 65 |ode to d|etermine|
|00000e20| 20 77 68 69 63 68 20 76 | 65 72 73 69 6f 6e 20 6f | which v|ersion o|
|00000e30| 66 20 74 68 65 20 6d 61 | 63 68 69 6e 65 20 79 6f |f the ma|chine yo|
|00000e40| 75 20 61 72 65 20 72 75 | 6e 6e 69 6e 67 20 6f 6e |u are ru|nning on|
|00000e50| 2c 20 75 6e 6c 65 73 73 | 20 69 74 20 69 73 20 61 |, unless| it is a|
|00000e60| 62 73 6f 6c 75 74 65 6c | 79 20 6e 65 63 65 73 73 |bsolutel|y necess|
|00000e70| 61 72 79 2e 0d 46 6f 72 | 20 74 68 65 20 70 75 72 |ary..For| the pur|
|00000e80| 70 6f 73 65 73 20 6f 66 | 20 74 68 69 73 20 64 69 |poses of| this di|
|00000e90| 73 63 75 73 73 69 6f 6e | 2c 20 74 68 65 20 74 65 |scussion|, the te|
|00000ea0| 72 6d 20 d2 70 72 6f 67 | 72 61 6d 73 d3 20 77 69 |rm .prog|rams. wi|
|00000eb0| 6c 6c 20 62 65 20 75 73 | 65 64 20 74 6f 20 64 65 |ll be us|ed to de|
|00000ec0| 73 63 72 69 62 65 20 61 | 6e 79 20 63 6f 64 65 20 |scribe a|ny code |
|00000ed0| 74 68 61 74 20 72 75 6e | 73 20 6f 6e 20 61 20 4d |that run|s on a M|
|00000ee0| 61 63 69 6e 74 6f 73 68 | 2e 20 54 68 69 73 20 69 |acintosh|. This i|
|00000ef0| 6e 63 6c 75 64 65 73 20 | 61 70 70 6c 69 63 61 74 |ncludes |applicat|
|00000f00| 69 6f 6e 73 2c 20 49 4e | 49 54 73 2c 20 46 4b 45 |ions, IN|ITs, FKE|
|00000f10| 59 73 2c 20 44 65 73 6b | 20 41 63 63 65 73 73 6f |Ys, Desk| Accesso|
|00000f20| 72 69 65 73 20 61 6e 64 | 20 44 72 69 76 65 72 73 |ries and| Drivers|
|00000f30| 2e 0d 57 68 61 74 20 74 | 68 65 20 d2 52 75 6c 65 |..What t|he .Rule|
|00000f40| 73 d3 20 6d 65 61 6e 0d | 43 6f 6d 70 61 74 69 62 |s. mean.|Compatib|
|00000f50| 69 6c 69 74 79 20 61 63 | 72 6f 73 73 20 61 6c 6c |ility ac|ross all|
|00000f60| 20 4d 61 63 69 6e 74 6f | 73 68 20 63 6f 6d 70 75 | Macinto|sh compu|
|00000f70| 74 65 72 73 20 28 77 68 | 69 63 68 20 6d 61 79 20 |ters (wh|ich may |
|00000f80| 73 6f 75 6e 64 20 6c 69 | 6b 65 20 69 74 20 69 6e |sound li|ke it in|
|00000f90| 76 6f 6c 76 65 73 20 6d | 6f 72 65 20 77 6f 72 6b |volves m|ore work|
|00000fa0| 20 66 6f 72 20 79 6f 75 | 29 20 6d 61 79 20 61 63 | for you|) may ac|
|00000fb0| 74 75 61 6c 6c 79 20 6d | 65 61 6e 20 74 68 61 74 |tually m|ean that|
|00000fc0| 20 79 6f 75 20 68 61 76 | 65 20 6c 65 73 73 20 77 | you hav|e less w|
|00000fd0| 6f 72 6b 20 74 6f 20 64 | 6f 2c 20 73 69 6e 63 65 |ork to d|o, since|
|00000fe0| 20 69 74 20 6d 61 79 20 | 6e 6f 74 20 62 65 20 6e | it may |not be n|
|00000ff0| 65 63 65 73 73 61 72 79 | 20 74 6f 20 72 65 76 69 |ecessary| to revi|
|00001000| 73 65 20 79 6f 75 72 20 | 70 72 6f 67 72 61 6d 20 |se your |program |
|00001010| 65 61 63 68 20 74 69 6d | 65 20 41 70 70 6c 65 20 |each tim|e Apple |
|00001020| 62 72 69 6e 67 73 20 6f | 75 74 20 61 20 6e 65 77 |brings o|ut a new|
|00001030| 20 63 6f 6d 70 75 74 65 | 72 20 6f 72 20 53 79 73 | compute|r or Sys|
|00001040| 74 65 6d 20 66 69 6c 65 | 2e 20 55 73 65 72 73 2c |tem file|. Users,|
|00001050| 20 61 73 20 61 20 67 72 | 6f 75 70 2c 20 64 6f 20 | as a gr|oup, do |
|00001060| 6e 6f 74 20 75 6e 64 65 | 72 73 74 61 6e 64 20 63 |not unde|rstand c|
|00001070| 6f 6d 70 61 74 69 62 69 | 6c 69 74 79 20 70 72 6f |ompatibi|lity pro|
|00001080| 62 6c 65 6d 73 3b 20 61 | 6c 6c 20 74 68 65 79 20 |blems; a|ll they |
|00001090| 73 65 65 20 69 73 20 74 | 68 61 74 20 74 68 65 20 |see is t|hat the |
|000010a0| 70 72 6f 67 72 61 6d 20 | 64 6f 65 73 20 6e 6f 74 |program |does not|
|000010b0| 20 72 75 6e 20 6f 6e 20 | 74 68 65 69 72 20 73 79 | run on |their sy|
|000010c0| 73 74 65 6d 2e 0d 54 68 | 65 20 62 65 6e 65 66 69 |stem..Th|e benefi|
|000010d0| 74 73 20 6f 66 20 62 65 | 69 6e 67 20 63 6f 6d 70 |ts of be|ing comp|
|000010e0| 61 74 69 62 6c 65 20 61 | 72 65 20 6d 61 6e 79 2d |atible a|re many-|
|000010f0| 66 6f 6c 64 3a 20 79 6f | 75 72 20 63 75 73 74 6f |fold: yo|ur custo|
|00001100| 6d 65 72 73 2f 75 73 65 | 72 73 20 73 74 61 79 20 |mers/use|rs stay |
|00001110| 68 61 70 70 79 2c 20 79 | 6f 75 20 68 61 76 65 20 |happy, y|ou have |
|00001120| 6c 65 73 73 20 70 72 6f | 67 72 61 6d 6d 69 6e 67 |less pro|gramming|
|00001130| 20 74 6f 20 64 6f 2c 20 | 79 6f 75 20 63 61 6e 20 | to do, |you can |
|00001140| 64 65 76 6f 74 65 20 79 | 6f 75 72 20 74 69 6d 65 |devote y|our time|
|00001150| 20 74 6f 20 6d 6f 72 65 | 20 76 61 6c 75 61 62 6c | to more| valuabl|
|00001160| 65 20 67 6f 61 6c 73 2c | 20 74 68 65 72 65 20 61 |e goals,| there a|
|00001170| 72 65 20 66 65 77 65 72 | 20 76 65 72 73 69 6f 6e |re fewer| version|
|00001180| 73 20 74 6f 20 64 65 61 | 6c 20 77 69 74 68 2c 20 |s to dea|l with, |
|00001190| 79 6f 75 72 20 63 6f 64 | 65 20 77 69 6c 6c 20 70 |your cod|e will p|
|000011a0| 72 6f 62 61 62 6c 79 20 | 62 65 20 6d 6f 72 65 20 |robably |be more |
|000011b0| 65 66 66 69 63 69 65 6e | 74 2c 20 79 6f 75 72 20 |efficien|t, your |
|000011c0| 75 73 65 72 73 20 77 69 | 6c 6c 20 6e 6f 74 20 63 |users wi|ll not c|
|000011d0| 75 72 73 65 20 79 6f 75 | 20 75 6e 64 65 72 20 74 |urse you| under t|
|000011e0| 68 65 69 72 20 62 72 65 | 61 74 68 2c 20 61 6e 64 |heir bre|ath, and|
|000011f0| 20 79 6f 75 72 20 6f 75 | 74 6c 6f 6f 6b 20 6f 6e | your ou|tlook on|
|00001200| 20 6c 69 66 65 20 77 69 | 6c 6c 20 62 65 20 6d 75 | life wi|ll be mu|
|00001210| 63 68 20 6d 65 72 72 69 | 65 72 2e 0d 4e 6f 77 20 |ch merri|er..Now |
|00001220| 74 68 61 74 20 77 65 20 | 6b 6e 6f 77 20 77 68 61 |that we |know wha|
|00001230| 74 20 62 65 69 6e 67 20 | 63 6f 6d 70 61 74 69 62 |t being |compatib|
|00001240| 6c 65 20 69 73 20 61 6c | 6c 20 61 62 6f 75 74 2c |le is al|l about,|
|00001250| 20 72 65 63 6f 67 6e 69 | 7a 65 20 74 68 61 74 20 | recogni|ze that |
|00001260| 6e 6f 62 6f 64 79 20 69 | 73 20 72 65 71 75 69 72 |nobody i|s requir|
|00001270| 69 6e 67 20 79 6f 75 20 | 74 6f 20 62 65 20 63 6f |ing you |to be co|
|00001280| 6d 70 61 74 69 62 6c 65 | 20 77 69 74 68 20 61 6e |mpatible| with an|
|00001290| 79 74 68 69 6e 67 2e 20 | 41 70 70 6c 65 20 64 6f |ything. |Apple do|
|000012a0| 65 73 20 6e 6f 74 20 65 | 6d 70 6c 6f 79 20 72 6f |es not e|mploy ro|
|000012b0| 76 69 6e 67 20 67 61 6e | 67 73 20 6f 66 20 74 68 |ving gan|gs of th|
|000012c0| 6f 75 67 68 74 20 70 6f | 6c 69 63 65 20 74 6f 20 |ought po|lice to |
|000012d0| 62 65 20 73 75 72 65 20 | 74 68 61 74 20 64 65 76 |be sure |that dev|
|000012e0| 65 6c 6f 70 65 72 73 20 | 61 72 65 20 66 6f 6c 6c |elopers |are foll|
|000012f0| 6f 77 69 6e 67 20 74 68 | 65 20 72 65 63 6f 6d 6d |owing th|e recomm|
|00001300| 65 6e 64 65 64 20 67 75 | 69 64 65 6c 69 6e 65 73 |ended gu|idelines|
|00001310| 2e 20 46 75 72 74 68 65 | 72 6d 6f 72 65 2c 20 77 |. Furthe|rmore, w|
|00001320| 68 65 6e 20 74 68 65 20 | 67 75 69 64 65 6c 69 6e |hen the |guidelin|
|00001330| 65 73 20 63 6f 6d 70 72 | 69 73 65 20 31 32 30 30 |es compr|ise 1200|
|00001340| 20 70 61 67 65 73 20 6f | 66 20 74 75 72 67 69 64 | pages o|f turgid|
|00001350| 20 70 72 6f 73 65 20 28 | 49 6e 73 69 64 65 20 4d | prose (|Inside M|
|00001360| 61 63 69 6e 74 6f 73 68 | 29 2c 20 79 6f 75 20 63 |acintosh|), you c|
|00001370| 61 6e 20 62 65 20 65 78 | 70 65 63 74 65 64 20 74 |an be ex|pected t|
|00001380| 6f 20 6d 69 73 73 20 6f | 6e 65 20 6f 72 20 74 77 |o miss o|ne or tw|
|00001390| 6f 20 6f 66 20 74 68 65 | 20 d2 72 75 6c 65 73 2e |o of the| .rules.|
|000013a0| d3 20 49 74 20 69 73 20 | 6e 6f 20 73 69 6e 20 74 |. It is |no sin t|
|000013b0| 6f 20 62 65 20 69 6e 63 | 6f 6d 70 61 74 69 62 6c |o be inc|ompatibl|
|000013c0| 65 2c 20 6e 6f 72 20 69 | 73 20 69 74 20 61 20 70 |e, nor i|s it a p|
|000013d0| 75 6e 69 73 68 61 62 6c | 65 20 6f 66 66 65 6e 73 |unishabl|e offens|
|000013e0| 65 2e 20 49 66 20 69 74 | 20 77 65 72 65 2c 20 74 |e. If it| were, t|
|000013f0| 68 65 72 65 20 77 6f 75 | 6c 64 20 62 65 20 6e 6f |here wou|ld be no|
|00001400| 20 4d 61 63 69 6e 74 6f | 73 68 20 70 72 6f 67 72 | Macinto|sh progr|
|00001410| 61 6d 73 2c 20 73 69 6e | 63 65 20 76 69 72 74 75 |ams, sin|ce virtu|
|00001420| 61 6c 6c 79 20 61 6c 6c | 20 64 65 76 65 6c 6f 70 |ally all| develop|
|00001430| 65 72 73 20 77 6f 75 6c | 64 20 62 65 20 69 6e 63 |ers woul|d be inc|
|00001440| 61 72 63 65 72 61 74 65 | 64 2e 20 57 68 61 74 20 |arcerate|d. What |
|00001450| 69 74 20 64 6f 65 73 20 | 6d 65 61 6e 2c 20 68 6f |it does |mean, ho|
|00001460| 77 65 76 65 72 2c 20 69 | 73 20 74 68 61 74 20 79 |wever, i|s that y|
|00001470| 6f 75 72 20 70 72 6f 67 | 72 61 6d 20 77 69 6c 6c |our prog|ram will|
|00001480| 20 62 65 20 75 6e 66 61 | 76 6f 72 61 62 6c 79 20 | be unfa|vorably |
|00001490| 76 69 65 77 65 64 20 75 | 6e 74 69 6c 20 69 74 20 |viewed u|ntil it |
|000014a0| 73 74 65 70 73 20 69 6e | 20 6c 69 6e 65 20 77 69 |steps in| line wi|
|000014b0| 74 68 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 73 |th the c|urrent s|
|000014c0| 79 73 74 65 6d 20 28 77 | 68 69 63 68 20 69 73 20 |ystem (w|hich is |
|000014d0| 61 20 6d 6f 76 69 6e 67 | 20 74 61 72 67 65 74 29 |a moving| target)|
|000014e0| 2e 20 49 66 20 61 20 70 | 72 6f 67 72 61 6d 20 62 |. If a p|rogram b|
|000014f0| 65 63 6f 6d 65 73 20 69 | 6e 63 6f 6d 70 61 74 69 |ecomes i|ncompati|
|00001500| 62 6c 65 20 77 69 74 68 | 20 61 20 6e 65 77 20 4d |ble with| a new M|
|00001510| 61 63 69 6e 74 6f 73 68 | 2c 20 69 74 20 75 73 75 |acintosh|, it usu|
|00001520| 61 6c 6c 79 20 72 65 71 | 75 69 72 65 73 20 72 65 |ally req|uires re|
|00001530| 74 68 69 6e 6b 69 6e 67 | 20 74 68 65 20 6f 66 66 |thinking| the off|
|00001540| 65 6e 64 69 6e 67 20 63 | 6f 64 65 2c 20 61 6e 64 |ending c|ode, and|
|00001550| 20 72 65 6c 65 61 73 69 | 6e 67 20 61 20 6e 65 77 | releasi|ng a new|
|00001560| 20 76 65 72 73 69 6f 6e | 2e 20 59 6f 75 20 6d 61 | version|. You ma|
|00001570| 79 20 72 65 61 64 20 73 | 6f 6d 65 74 68 69 6e 67 |y read s|omething|
|00001580| 20 6c 69 6b 65 20 d2 49 | 66 20 74 68 65 20 64 65 | like .I|f the de|
|00001590| 76 65 6c 6f 70 65 72 73 | 20 66 6f 6c 6c 6f 77 65 |velopers| followe|
|000015a0| 64 20 41 70 70 6c 65 20 | 67 75 69 64 65 6c 69 6e |d Apple |guidelin|
|000015b0| 65 73 2c 20 74 68 65 79 | 20 77 6f 75 6c 64 20 62 |es, they| would b|
|000015c0| 65 20 63 6f 6d 70 61 74 | 69 62 6c 65 20 77 69 74 |e compat|ible wit|
|000015d0| 68 20 74 68 65 20 74 72 | 61 6e 73 76 65 72 73 65 |h the tr|ansverse|
|000015e0| 2d 68 69 6e 67 65 64 20 | 64 69 61 74 6f 6d 69 63 |-hinged |diatomic|
|000015f0| 20 71 75 61 72 6b 20 72 | 65 61 6c 69 67 6e 6d 65 | quark r|ealignme|
|00001600| 6e 74 20 73 79 73 74 65 | 6d 2e d3 20 54 68 69 73 |nt syste|m.. This|
|00001610| 20 6d 65 61 6e 73 20 74 | 68 61 74 20 69 66 20 79 | means t|hat if y|
|00001620| 6f 75 20 6d 61 64 65 20 | 61 6e 79 20 6d 69 73 74 |ou made |any mist|
|00001630| 61 6b 65 73 20 28 79 6f | 75 20 72 65 61 64 20 61 |akes (yo|u read a|
|00001640| 6c 6c 20 31 32 30 30 20 | 70 61 67 65 73 20 63 61 |ll 1200 |pages ca|
|00001650| 72 65 66 75 6c 6c 79 2c | 20 72 69 67 68 74 3f 29 |refully,| right?)|
|00001660| 2c 20 79 6f 75 20 77 69 | 6c 6c 20 6e 6f 74 20 62 |, you wi|ll not b|
|00001670| 65 20 63 6f 6d 70 61 74 | 69 62 6c 65 2e 20 49 74 |e compat|ible. It|
|00001680| 20 69 73 20 65 78 74 72 | 65 6d 65 6c 79 20 64 69 | is extr|emely di|
|00001690| 66 66 69 63 75 6c 74 20 | 74 6f 20 72 65 6d 61 69 |fficult |to remai|
|000016a0| 6e 20 63 6f 6d 70 6c 65 | 74 65 6c 79 20 63 6f 6d |n comple|tely com|
|000016b0| 70 61 74 69 62 6c 65 2c | 20 70 61 72 74 69 63 75 |patible,| particu|
|000016c0| 6c 61 72 6c 79 20 69 6e | 20 61 20 73 79 73 74 65 |larly in| a syste|
|000016d0| 6d 20 61 73 20 63 6f 6d | 70 6c 65 78 20 61 73 20 |m as com|plex as |
|000016e0| 74 68 65 20 4d 61 63 69 | 6e 74 6f 73 68 2e 20 54 |the Maci|ntosh. T|
|000016f0| 68 65 20 72 75 6c 65 73 | 20 68 61 76 65 6e d5 74 |he rules| haven.t|
|00001700| 20 63 68 61 6e 67 65 64 | 2c 20 62 75 74 20 77 68 | changed|, but wh|
|00001710| 61 74 20 79 6f 75 20 63 | 61 6e 20 67 65 74 20 61 |at you c|an get a|
|00001720| 77 61 79 20 77 69 74 68 | 20 68 61 73 2e 20 54 68 |way with| has. Th|
|00001730| 65 72 65 20 61 72 65 2c | 20 68 6f 77 65 76 65 72 |ere are,| however|
|00001740| 2c 20 61 20 6e 75 6d 62 | 65 72 20 6f 66 20 74 68 |, a numb|er of th|
|00001750| 69 6e 67 73 20 74 68 61 | 74 20 79 6f 75 20 63 61 |ings tha|t you ca|
|00001760| 6e 20 64 6f 20 74 6f 20 | 69 6d 70 72 6f 76 65 20 |n do to |improve |
|00001770| 79 6f 75 72 20 6f 64 64 | 73 d1 73 6f 6d 65 20 6f |your odd|s.some o|
|00001780| 66 20 77 68 69 63 68 20 | 77 69 6c 6c 20 62 65 20 |f which |will be |
|00001790| 65 78 70 6c 61 69 6e 65 | 64 20 68 65 72 65 2e 0d |explaine|d here..|
|000017a0| 49 74 d5 73 20 79 6f 75 | 72 20 63 68 6f 69 63 65 |It.s you|r choice|
|000017b0| 0d 49 74 20 69 73 20 73 | 74 69 6c 6c 20 79 6f 75 |.It is s|till you|
|000017c0| 72 20 63 68 6f 69 63 65 | 20 77 68 65 74 68 65 72 |r choice| whether|
|000017d0| 20 79 6f 75 20 77 69 6c | 6c 20 62 65 20 63 6f 6e | you wil|l be con|
|000017e0| 63 65 72 6e 65 64 20 77 | 69 74 68 20 63 6f 6d 70 |cerned w|ith comp|
|000017f0| 61 74 69 62 69 6c 69 74 | 79 20 6f 72 20 6e 6f 74 |atibilit|y or not|
|00001800| 2e 20 41 70 70 6c 65 20 | 77 69 6c 6c 20 6e 6f 74 |. Apple |will not|
|00001810| 20 70 75 74 20 6f 75 74 | 20 61 20 77 61 72 72 61 | put out| a warra|
|00001820| 6e 74 20 66 6f 72 20 79 | 6f 75 72 20 61 72 72 65 |nt for y|our arre|
|00001830| 73 74 2e 20 48 6f 77 65 | 76 65 72 2c 20 69 66 20 |st. Howe|ver, if |
|00001840| 79 6f 75 20 61 72 65 20 | 64 6f 69 6e 67 20 74 68 |you are |doing th|
|00001850| 69 6e 67 73 20 74 68 61 | 74 20 61 72 65 20 73 70 |ings tha|t are sp|
|00001860| 65 63 69 66 69 63 61 6c | 6c 79 20 69 6c 6c 65 67 |ecifical|ly illeg|
|00001870| 61 6c 2c 20 41 70 70 6c | 65 20 77 69 6c 6c 20 61 |al, Appl|e will a|
|00001880| 6c 73 6f 20 6e 6f 74 20 | 77 6f 72 72 79 20 61 62 |lso not |worry ab|
|00001890| 6f 75 74 20 d2 62 72 65 | 61 6b 69 6e 67 d3 20 79 |out .bre|aking. y|
|000018a0| 6f 75 72 20 70 72 6f 67 | 72 61 6d 2e 0d 42 61 64 |our prog|ram..Bad|
|000018b0| 20 54 68 69 6e 67 73 0d | 54 68 65 20 66 6f 6c 6c | Things.|The foll|
|000018c0| 6f 77 69 6e 67 20 6c 69 | 73 74 20 69 73 20 6e 6f |owing li|st is no|
|000018d0| 74 20 69 6e 74 65 6e 64 | 65 64 20 74 6f 20 62 65 |t intend|ed to be|
|000018e0| 20 63 6f 6d 70 72 65 68 | 65 6e 73 69 76 65 2c 20 | compreh|ensive, |
|000018f0| 62 75 74 20 74 68 65 73 | 65 20 61 72 65 20 74 68 |but thes|e are th|
|00001900| 65 20 70 72 69 6d 61 72 | 79 20 72 65 61 73 6f 6e |e primar|y reason|
|00001910| 73 20 77 68 79 20 70 72 | 6f 67 72 61 6d 73 20 62 |s why pr|ograms b|
|00001920| 72 65 61 6b 20 66 72 6f | 6d 20 6f 6e 65 20 76 65 |reak fro|m one ve|
|00001930| 72 73 69 6f 6e 20 6f 66 | 20 74 68 65 20 73 79 73 |rsion of| the sys|
|00001940| 74 65 6d 20 74 6f 20 74 | 68 65 20 6e 65 78 74 2e |tem to t|he next.|
|00001950| 20 54 68 65 73 65 20 61 | 72 65 20 74 68 65 20 63 | These a|re the c|
|00001960| 75 72 72 65 6e 74 20 74 | 6f 70 20 74 65 6e 20 63 |urrent t|op ten c|
|00001970| 6f 6d 6d 61 6e 64 6d 65 | 6e 74 73 3a 0d 49 09 54 |ommandme|nts:.I.T|
|00001980| 68 6f 75 20 73 68 61 6c | 74 20 6e 6f 74 20 61 73 |hou shal|t not as|
|00001990| 73 75 6d 65 20 74 68 65 | 20 73 63 72 65 65 6e 20 |sume the| screen |
|000019a0| 69 73 20 61 20 66 69 78 | 65 64 20 73 69 7a 65 2e |is a fix|ed size.|
|000019b0| 0d 49 49 09 54 68 6f 75 | 20 73 68 61 6c 74 20 6e |.II.Thou| shalt n|
|000019c0| 6f 74 20 61 73 73 75 6d | 65 20 74 68 65 20 73 63 |ot assum|e the sc|
|000019d0| 72 65 65 6e 20 69 73 20 | 61 74 20 61 20 66 69 78 |reen is |at a fix|
|000019e0| 65 64 20 6c 6f 63 61 74 | 69 6f 6e 2e 0d 49 49 49 |ed locat|ion..III|
|000019f0| 09 54 68 6f 75 20 73 68 | 61 6c 74 20 6e 6f 74 20 |.Thou sh|alt not |
|00001a00| 61 73 73 75 6d 65 20 74 | 68 61 74 20 72 6f 77 42 |assume t|hat rowB|
|00001a10| 79 74 65 73 20 69 73 20 | 65 71 75 61 6c 20 74 6f |ytes is |equal to|
|00001a20| 20 74 68 65 20 77 69 64 | 74 68 20 6f 66 20 74 68 | the wid|th of th|
|00001a30| 65 20 73 63 72 65 65 6e | 2e 0d 49 56 09 54 68 6f |e screen|..IV.Tho|
|00001a40| 75 20 73 68 61 6c 74 20 | 6e 6f 74 20 75 73 65 20 |u shalt |not use |
|00001a50| 6e 69 6c 20 68 61 6e 64 | 6c 65 73 20 6f 72 20 6e |nil hand|les or n|
|00001a60| 69 6c 20 70 6f 69 6e 74 | 65 72 73 2e 0d 56 09 54 |il point|ers..V.T|
|00001a70| 68 6f 75 20 73 68 61 6c | 74 20 6e 6f 74 20 63 72 |hou shal|t not cr|
|00001a80| 65 61 74 65 20 6f 72 20 | 75 73 65 20 66 61 6b 65 |eate or |use fake|
|00001a90| 20 68 61 6e 64 6c 65 73 | 2e 0d 56 49 09 54 68 6f | handles|..VI.Tho|
|00001aa0| 75 20 73 68 61 6c 74 20 | 6e 6f 74 20 77 72 69 74 |u shalt |not writ|
|00001ab0| 65 20 63 6f 64 65 20 74 | 68 61 74 20 6d 6f 64 69 |e code t|hat modi|
|00001ac0| 66 69 65 73 20 69 74 73 | 65 6c 66 2e 0d 56 49 49 |fies its|elf..VII|
|00001ad0| 09 54 68 6f 75 20 73 68 | 61 6c 74 20 74 68 69 6e |.Thou sh|alt thin|
|00001ae0| 6b 20 74 77 69 63 65 20 | 61 62 6f 75 74 20 63 6f |k twice |about co|
|00001af0| 64 65 20 64 65 73 69 67 | 6e 65 64 20 73 74 72 69 |de desig|ned stri|
|00001b00| 63 74 6c 79 20 61 73 20 | 63 6f 70 79 20 70 72 6f |ctly as |copy pro|
|00001b10| 74 65 63 74 69 6f 6e 2e | 0d 56 49 49 49 09 54 68 |tection.|.VIII.Th|
|00001b20| 6f 75 20 73 68 61 6c 74 | 20 63 68 65 63 6b 20 65 |ou shalt| check e|
|00001b30| 72 72 6f 72 73 20 72 65 | 74 75 72 6e 65 64 20 61 |rrors re|turned a|
|00001b40| 73 20 66 75 6e 63 74 69 | 6f 6e 20 72 65 73 75 6c |s functi|on resul|
|00001b50| 74 73 2e 0d 49 58 09 54 | 68 6f 75 20 73 68 61 6c |ts..IX.T|hou shal|
|00001b60| 74 20 6e 6f 74 20 61 63 | 63 65 73 73 20 68 61 72 |t not ac|cess har|
|00001b70| 64 77 61 72 65 20 64 69 | 72 65 63 74 6c 79 2e 0d |dware di|rectly..|
|00001b80| 58 09 54 68 6f 75 20 73 | 68 61 6c 74 20 6e 6f 74 |X.Thou s|halt not|
|00001b90| 20 75 73 65 20 61 6e 79 | 20 6f 66 20 74 68 65 20 | use any| of the |
|00001ba0| 62 69 74 73 20 74 68 61 | 74 20 61 72 65 20 72 65 |bits tha|t are re|
|00001bb0| 73 65 72 76 65 64 20 28 | 75 6e 75 73 65 64 20 6d |served (|unused m|
|00001bc0| 65 61 6e 73 20 72 65 73 | 65 72 76 65 64 29 2e 0d |eans res|erved)..|
|00001bd0| 54 68 69 73 20 68 61 73 | 20 62 65 65 6e 20 64 65 |This has| been de|
|00001be0| 74 65 72 6d 69 6e 65 64 | 20 66 72 6f 6d 20 65 78 |termined| from ex|
|00001bf0| 74 65 6e 73 69 76 65 20 | 74 65 73 74 69 6e 67 20 |tensive |testing |
|00001c00| 6f 66 20 6f 75 72 20 64 | 69 76 65 72 73 65 20 73 |of our d|iverse s|
|00001c10| 6f 66 74 77 61 72 65 20 | 62 61 73 65 2e 0d 41 73 |oftware |base..As|
|00001c20| 73 75 6d 69 6e 67 20 74 | 68 65 20 73 63 72 65 65 |suming t|he scree|
|00001c30| 6e 20 69 73 20 61 20 66 | 69 78 65 64 20 73 69 7a |n is a f|ixed siz|
|00001c40| 65 0d 44 6f 20 6e 6f 74 | 20 61 73 73 75 6d 65 20 |e.Do not| assume |
|00001c50| 74 68 61 74 20 74 68 65 | 20 4d 61 63 69 6e 74 6f |that the| Macinto|
|00001c60| 73 68 20 73 63 72 65 65 | 6e 20 69 73 20 35 31 32 |sh scree|n is 512|
|00001c70| 20 78 20 33 34 32 20 70 | 69 78 65 6c 73 2e 20 50 | x 342 p|ixels. P|
|00001c80| 72 6f 67 72 61 6d 73 20 | 74 68 61 74 20 64 6f 20 |rograms |that do |
|00001c90| 67 65 6e 65 72 61 6c 6c | 79 20 68 61 76 65 20 70 |generall|y have p|
|00001ca0| 72 6f 62 6c 65 6d 73 20 | 6f 6e 20 28 6f 72 20 73 |roblems |on (or s|
|00001cb0| 70 65 63 69 61 6c 20 63 | 61 73 65 20 66 6f 72 29 |pecial c|ase for)|
|00001cc0| 20 74 68 65 20 4d 61 63 | 69 6e 74 6f 73 68 20 58 | the Mac|intosh X|
|00001cd0| 4c 2c 20 77 68 69 63 68 | 20 68 61 73 20 61 20 77 |L, which| has a w|
|00001ce0| 69 64 65 72 20 73 63 72 | 65 65 6e 2e 20 4d 6f 73 |ider scr|een. Mos|
|00001cf0| 74 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 73 20 68 |t applic|ations h|
|00001d00| 61 76 65 20 74 6f 20 63 | 72 65 61 74 65 20 74 68 |ave to c|reate th|
|00001d10| 65 20 62 6f 75 6e 64 69 | 6e 67 20 72 65 63 74 61 |e boundi|ng recta|
|00001d20| 6e 67 6c 65 20 77 68 65 | 72 65 20 61 20 77 69 6e |ngle whe|re a win|
|00001d30| 64 6f 77 20 63 61 6e 20 | 62 65 20 64 72 61 67 67 |dow can |be dragg|
|00001d40| 65 64 2e 20 54 68 69 73 | 20 69 73 20 74 68 65 20 |ed. This| is the |
|00001d50| 62 6f 75 6e 64 73 52 65 | 63 74 20 74 68 61 74 20 |boundsRe|ct that |
|00001d60| 69 73 20 70 61 73 73 65 | 64 20 74 6f 20 74 68 65 |is passe|d to the|
|00001d70| 20 63 61 6c 6c 3a 0d 09 | 44 72 61 67 57 69 6e 64 | call:..|DragWind|
|00001d80| 6f 77 20 28 6d 79 57 69 | 6e 64 6f 77 50 74 72 2c |ow (myWi|ndowPtr,|
|00001d90| 20 74 68 65 45 76 65 6e | 74 2e 77 68 65 72 65 2c | theEven|t.where,|
|00001da0| 20 62 6f 75 6e 64 73 52 | 65 63 74 29 3b 0d 53 6f | boundsR|ect);.So|
|00001db0| 6d 65 20 69 6c 6c 2d 61 | 64 76 69 73 65 64 20 70 |me ill-a|dvised p|
|00001dc0| 72 6f 67 72 61 6d 73 20 | 63 72 65 61 74 65 20 74 |rograms |create t|
|00001dd0| 68 65 20 62 6f 75 6e 64 | 73 52 65 63 74 20 62 79 |he bound|sRect by|
|00001de0| 20 73 6f 6d 65 74 68 69 | 6e 67 20 6c 69 6b 65 3a | somethi|ng like:|
|00001df0| 0d 09 53 65 74 52 65 63 | 74 20 28 62 6f 75 6e 64 |..SetRec|t (bound|
|00001e00| 73 52 65 63 74 2c 20 30 | 2c 30 2c 33 34 32 2c 35 |sRect, 0|,0,342,5|
|00001e10| 31 32 29 3b 20 20 7b 20 | 6f 6f 70 73 2c 20 74 68 |12); { |oops, th|
|00001e20| 69 73 20 69 73 20 68 61 | 72 64 2d 63 6f 64 65 64 |is is ha|rd-coded|
|00001e30| c9 7d 0d 57 68 79 20 69 | 74 d5 73 20 42 61 64 0d |.}.Why i|t.s Bad.|
|00001e40| 54 68 69 73 20 69 73 20 | 62 61 64 20 62 65 63 61 |This is |bad beca|
|00001e50| 75 73 65 20 69 74 20 69 | 73 20 6e 65 76 65 72 20 |use it i|s never |
|00001e60| 6e 65 63 65 73 73 61 72 | 79 20 74 6f 20 73 70 65 |necessar|y to spe|
|00001e70| 63 69 66 69 63 61 6c 6c | 79 20 70 75 74 20 69 6e |cificall|y put in|
|00001e80| 20 74 68 65 20 62 6f 75 | 6e 64 69 6e 67 20 72 65 | the bou|nding re|
|00001e90| 63 74 61 6e 67 6c 65 20 | 66 6f 72 20 74 68 65 20 |ctangle |for the |
|00001ea0| 73 63 72 65 65 6e 2e 20 | 4f 6e 20 61 20 4d 61 63 |screen. |On a Mac|
|00001eb0| 69 6e 74 6f 73 68 20 58 | 4c 20 66 6f 72 20 65 78 |intosh X|L for ex|
|00001ec0| 61 6d 70 6c 65 2c 20 74 | 68 65 20 73 63 72 65 65 |ample, t|he scree|
|00001ed0| 6e 20 73 69 7a 65 20 69 | 73 20 37 36 30 78 33 36 |n size i|s 760x36|
|00001ee0| 34 20 28 61 6e 64 20 73 | 6f 6d 65 74 69 6d 65 73 |4 (and s|ometimes|
|00001ef0| 20 36 30 38 78 34 33 31 | 20 77 69 74 68 20 61 6c | 608x431| with al|
|00001f00| 74 65 72 6e 61 74 65 20 | 68 61 72 64 77 61 72 65 |ternate |hardware|
|00001f10| 29 2e 20 49 66 20 61 20 | 70 72 6f 67 72 61 6d 20 |). If a |program |
|00001f20| 75 73 65 73 20 74 68 65 | 20 68 61 72 64 2d 63 6f |uses the| hard-co|
|00001f30| 64 65 64 20 30 2c 30 2c | 33 34 32 2c 35 31 32 20 |ded 0,0,|342,512 |
|00001f40| 61 73 20 61 20 62 6f 75 | 6e 64 69 6e 67 20 72 65 |as a bou|nding re|
|00001f50| 63 74 61 6e 67 6c 65 2c | 20 65 6e 64 20 75 73 65 |ctangle,| end use|
|00001f60| 72 73 20 77 69 6c 6c 20 | 6e 6f 74 20 62 65 20 61 |rs will |not be a|
|00001f70| 62 6c 65 20 74 6f 20 6d | 6f 76 65 20 74 68 65 69 |ble to m|ove thei|
|00001f80| 72 20 77 69 6e 64 6f 77 | 73 20 70 61 73 74 20 74 |r window|s past t|
|00001f90| 68 65 20 66 69 63 74 69 | 74 69 6f 75 73 20 62 6f |he ficti|tious bo|
|00001fa0| 75 6e 64 61 72 79 20 6f | 66 20 35 31 32 2e 20 49 |undary o|f 512. I|
|00001fb0| 66 20 73 6f 6d 65 74 68 | 69 6e 67 20 73 69 6d 69 |f someth|ing simi|
|00001fc0| 6c 61 72 20 77 65 72 65 | 20 64 6f 6e 65 20 74 6f |lar were| done to|
|00001fd0| 20 74 68 65 20 47 72 6f | 77 57 69 6e 64 6f 77 20 | the Gro|wWindow |
|00001fe0| 63 61 6c 6c 2c 20 69 74 | 20 77 6f 75 6c 64 20 6d |call, it| would m|
|00001ff0| 61 6b 65 20 69 74 20 69 | 6d 70 6f 73 73 69 62 6c |ake it i|mpossibl|
|00002000| 65 20 66 6f 72 20 75 73 | 65 72 73 20 74 6f 20 67 |e for us|ers to g|
|00002010| 72 6f 77 20 74 68 65 69 | 72 20 77 69 6e 64 6f 77 |row thei|r window|
|00002020| 20 74 6f 20 66 69 6c 6c | 20 74 68 65 20 65 6e 74 | to fill| the ent|
|00002030| 69 72 65 20 73 63 72 65 | 65 6e 2e 20 28 41 6c 77 |ire scre|en. (Alw|
|00002040| 61 79 73 20 61 20 73 61 | 64 64 65 6e 69 6e 67 20 |ays a sa|ddening |
|00002050| 77 61 73 74 65 20 6f 66 | 20 76 61 6c 75 61 62 6c |waste of| valuabl|
|00002060| 65 20 73 63 72 65 65 6e | 20 72 65 61 6c 2d 65 73 |e screen| real-es|
|00002070| 74 61 74 65 2e 29 0d 41 | 73 73 75 6d 69 6e 67 20 |tate.).A|ssuming |
|00002080| 73 63 72 65 65 6e 20 73 | 69 7a 65 20 6d 61 6b 65 |screen s|ize make|
|00002090| 73 20 69 74 20 6d 6f 72 | 65 20 64 69 66 66 69 63 |s it mor|e diffic|
|000020a0| 75 6c 74 20 74 6f 20 75 | 73 65 20 74 68 65 20 70 |ult to u|se the p|
|000020b0| 72 6f 67 72 61 6d 20 6f | 6e 20 4d 61 63 69 6e 74 |rogram o|n Macint|
|000020c0| 6f 73 68 65 73 20 77 69 | 74 68 20 62 69 67 20 73 |oshes wi|th big s|
|000020d0| 63 72 65 65 6e 73 2c 20 | 62 79 20 6d 61 6b 69 6e |creens, |by makin|
|000020e0| 67 20 69 74 20 64 69 66 | 66 69 63 75 6c 74 20 74 |g it dif|ficult t|
|000020f0| 6f 20 67 72 6f 77 20 6f | 72 20 6d 6f 76 65 20 77 |o grow o|r move w|
|00002100| 69 6e 64 6f 77 73 2c 20 | 6f 72 20 62 79 20 64 72 |indows, |or by dr|
|00002110| 61 77 69 6e 67 20 69 6e | 20 73 74 72 61 6e 67 65 |awing in| strange|
|00002120| 20 70 6c 61 63 65 73 20 | 77 68 65 72 65 20 74 68 | places |where th|
|00002130| 65 79 20 73 68 6f 75 6c | 64 20 6e 6f 74 20 62 65 |ey shoul|d not be|
|00002140| 20 64 72 61 77 69 6e 67 | 20 28 6f 75 74 73 69 64 | drawing| (outsid|
|00002150| 65 20 6f 66 20 77 69 6e | 64 6f 77 73 29 2e 20 43 |e of win|dows). C|
|00002160| 6f 6e 73 69 64 65 72 20 | 74 68 65 20 63 61 73 65 |onsider |the case|
|00002170| 20 6f 66 20 72 75 6e 6e | 69 6e 67 20 6f 6e 20 61 | of runn|ing on a|
|00002180| 20 4d 61 63 69 6e 74 6f | 73 68 20 65 71 75 69 70 | Macinto|sh equip|
|00002190| 70 65 64 20 77 69 74 68 | 20 6f 6e 65 20 6f 66 20 |ped with| one of |
|000021a0| 74 68 65 20 66 75 6c 6c | 20 70 61 67 65 20 64 69 |the full| page di|
|000021b0| 73 70 6c 61 79 73 2c 20 | 6f 72 20 55 6c 74 72 61 |splays, |or Ultra|
|000021c0| 2d 4c 61 72 67 65 20 73 | 63 72 65 65 6e 73 2e 20 |-Large s|creens. |
|000021d0| 4e 6f 20 6f 6e 65 20 77 | 68 6f 20 70 61 69 64 20 |No one w|ho paid |
|000021e0| 66 6f 72 20 61 20 62 69 | 67 20 73 63 72 65 65 6e |for a bi|g screen|
|000021f0| 20 77 61 6e 74 73 20 74 | 6f 20 62 65 20 72 65 73 | wants t|o be res|
|00002200| 74 72 69 63 74 65 64 20 | 74 6f 20 75 73 69 6e 67 |tricted |to using|
|00002210| 20 6f 6e 6c 79 20 74 68 | 65 20 75 70 70 65 72 2d | only th|e upper-|
|00002220| 6c 65 66 74 20 63 6f 72 | 6e 65 72 20 6f 66 20 69 |left cor|ner of i|
|00002230| 74 2e 0d 48 6f 77 20 74 | 6f 20 61 76 6f 69 64 20 |t..How t|o avoid |
|00002240| 62 65 63 6f 6d 69 6e 67 | 20 61 20 73 63 72 65 65 |becoming| a scree|
|00002250| 6e 69 6e 67 20 66 61 73 | 63 69 73 74 0d 4e 65 76 |ning fas|cist.Nev|
|00002260| 65 72 20 68 61 72 64 20 | 63 6f 64 65 20 74 68 65 |er hard |code the|
|00002270| 20 6e 75 6d 62 65 72 73 | 20 35 31 32 20 61 6e 64 | numbers| 512 and|
|00002280| 20 33 34 32 20 66 6f 72 | 20 73 63 72 65 65 6e 20 | 342 for| screen |
|00002290| 64 69 6d 65 6e 73 69 6f | 6e 73 2e 20 59 6f 75 20 |dimensio|ns. You |
|000022a0| 73 68 6f 75 6c 64 20 61 | 76 6f 69 64 20 75 73 69 |should a|void usi|
|000022b0| 6e 67 20 63 6f 6e 73 74 | 61 6e 74 73 20 66 6f 72 |ng const|ants for|
|000022c0| 20 73 79 73 74 65 6d 20 | 76 61 6c 75 65 73 20 74 | system |values t|
|000022d0| 68 61 74 20 63 61 6e 20 | 63 68 61 6e 67 65 2e 20 |hat can |change. |
|000022e0| 50 61 72 61 6d 65 74 65 | 72 73 20 6c 69 6b 65 20 |Paramete|rs like |
|000022f0| 74 68 65 73 65 20 61 72 | 65 20 6e 65 61 72 6c 79 |these ar|e nearly|
|00002300| 20 61 6c 77 61 79 73 20 | 61 76 61 69 6c 61 62 6c | always |availabl|
|00002310| 65 20 69 6e 20 61 20 64 | 79 6e 61 6d 69 63 20 66 |e in a d|ynamic f|
|00002320| 61 73 68 69 6f 6e 2e 20 | 50 72 6f 67 72 61 6d 73 |ashion. |Programs|
|00002330| 20 73 68 6f 75 6c 64 20 | 72 65 61 64 20 74 68 65 | should |read the|
|00002340| 20 61 70 70 72 6f 70 72 | 69 61 74 65 20 76 61 72 | appropr|iate var|
|00002350| 69 61 62 6c 65 73 20 77 | 68 69 6c 65 20 74 68 65 |iables w|hile the|
|00002360| 20 70 72 6f 67 72 61 6d | 20 69 73 20 72 75 6e 6e | program| is runn|
|00002370| 69 6e 67 20 28 61 74 20 | 72 75 6e 2d 74 69 6d 65 |ing (at |run-time|
|00002380| 2c 20 6e 6f 74 20 61 74 | 20 63 6f 6d 70 69 6c 65 |, not at| compile|
|00002390| 20 74 69 6d 65 29 2e 0d | 48 65 72 65 d5 73 20 68 | time)..|Here.s h|
|000023a0| 6f 77 20 73 6d 61 72 74 | 20 70 72 6f 67 72 61 6d |ow smart| program|
|000023b0| 73 20 67 65 74 20 74 68 | 65 20 73 63 72 65 65 6e |s get th|e screen|
|000023c0| 20 64 69 6d 65 6e 73 69 | 6f 6e 73 3a 0d 09 49 6e | dimensi|ons:..In|
|000023d0| 69 74 47 72 61 66 28 40 | 74 68 65 50 6f 72 74 29 |itGraf(@|thePort)|
|000023e0| 3b 20 7b 20 51 75 69 63 | 6b 44 72 61 77 20 67 6c |; { Quic|kDraw gl|
|000023f0| 6f 62 61 6c 20 76 61 72 | 69 61 62 6c 65 73 20 68 |obal var|iables h|
|00002400| 61 76 65 20 74 6f 20 62 | 65 20 69 6e 69 74 69 61 |ave to b|e initia|
|00002410| 6c 69 7a 65 64 2e 7d 0d | 09 c9 0d 09 62 6f 75 6e |lized.}.|....boun|
|00002420| 64 73 52 65 63 74 20 3a | 3d 20 73 63 72 65 65 6e |dsRect :|= screen|
|00002430| 42 69 74 73 2e 62 6f 75 | 6e 64 73 3b 20 20 20 7b |Bits.bou|nds; {|
|00002440| 20 54 68 65 20 52 65 61 | 6c 20 77 61 79 20 74 6f | The Rea|l way to|
|00002450| 20 67 65 74 20 73 63 72 | 65 65 6e 20 73 69 7a 65 | get scr|een size|
|00002460| 20 7d 0d 09 09 20 20 20 | 20 20 20 20 20 20 20 20 | }... | |
|00002470| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002480| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 09 09 20 | | .. |
|00002490| 20 7b 20 55 73 65 20 51 | 75 69 63 6b 44 72 61 77 | { Use Q|uickDraw|
|000024a0| 20 67 6c 6f 62 61 6c 20 | 76 61 72 69 61 62 6c 65 | global |variable|
|000024b0| 2e 20 7d 0d 54 68 69 73 | 20 69 73 20 73 6d 61 72 |. }.This| is smar|
|000024c0| 74 2c 20 62 65 63 61 75 | 73 65 20 74 68 65 20 70 |t, becau|se the p|
|000024d0| 72 6f 67 72 61 6d 20 6e | 65 76 65 72 20 68 61 73 |rogram n|ever has|
|000024e0| 20 74 6f 20 6b 6e 6f 77 | 20 73 70 65 63 69 66 69 | to know| specifi|
|000024f0| 63 61 6c 6c 79 20 77 68 | 61 74 20 74 68 65 20 6e |cally wh|at the n|
|00002500| 75 6d 62 65 72 73 20 61 | 72 65 2e 20 41 6c 6c 20 |umbers a|re. All |
|00002510| 72 65 66 65 72 65 6e 63 | 65 73 20 74 6f 20 72 65 |referenc|es to re|
|00002520| 63 74 61 6e 67 6c 65 73 | 20 74 68 61 74 20 6e 65 |ctangles| that ne|
|00002530| 65 64 20 74 6f 20 62 65 | 20 72 65 6c 61 74 65 64 |ed to be| related|
|00002540| 20 74 6f 20 74 68 65 20 | 73 63 72 65 65 6e 20 28 | to the |screen (|
|00002550| 6c 69 6b 65 20 74 68 65 | 20 64 72 61 67 20 61 6e |like the| drag an|
|00002560| 64 20 67 72 6f 77 20 61 | 72 65 61 73 20 6f 66 20 |d grow a|reas of |
|00002570| 77 69 6e 64 6f 77 73 29 | 20 73 68 6f 75 6c 64 20 |windows)| should |
|00002580| 75 73 65 20 73 63 72 65 | 65 6e 42 69 74 73 2e 62 |use scre|enBits.b|
|00002590| 6f 75 6e 64 73 20 74 6f | 20 61 76 6f 69 64 20 77 |ounds to| avoid w|
|000025a0| 6f 72 72 79 69 6e 67 20 | 61 62 6f 75 74 20 74 68 |orrying |about th|
|000025b0| 65 20 73 63 72 65 65 6e | 20 73 69 7a 65 2e 0d 4e |e screen| size..N|
|000025c0| 6f 74 65 20 74 68 61 74 | 20 74 68 69 73 20 64 6f |ote that| this do|
|000025d0| 65 73 20 6e 6f 74 20 64 | 6f 20 61 6e 79 74 68 69 |es not d|o anythi|
|000025e0| 6e 67 20 72 65 6d 6f 74 | 65 6c 79 20 6c 69 6b 65 |ng remot|ely like|
|000025f0| 20 61 73 73 75 6d 65 20 | 74 68 61 74 20 d2 69 66 | assume |that .if|
|00002600| 20 74 68 65 20 63 6f 6d | 70 75 74 65 72 20 69 73 | the com|puter is|
|00002610| 20 6e 6f 74 20 61 20 73 | 74 61 6e 64 61 72 64 20 | not a s|tandard |
|00002620| 4d 61 63 69 6e 74 6f 73 | 68 2c 20 74 68 65 6e 20 |Macintos|h, then |
|00002630| 69 74 20 6d 75 73 74 20 | 62 65 20 61 6e 20 58 4c |it must |be an XL|
|00002640| 2e d3 20 53 70 65 63 69 | 61 6c 20 63 61 73 69 6e |.. Speci|al casin|
|00002650| 67 20 66 6f 72 20 74 68 | 65 20 76 61 72 69 6f 75 |g for th|e variou|
|00002660| 73 20 76 65 72 73 69 6f | 6e 73 20 6f 66 20 74 68 |s versio|ns of th|
|00002670| 65 20 4d 61 63 69 6e 74 | 6f 73 68 20 68 61 73 20 |e Macint|osh has |
|00002680| 61 6c 77 61 79 73 20 62 | 65 65 6e 20 73 75 73 70 |always b|een susp|
|00002690| 69 63 69 6f 75 73 20 61 | 74 20 62 65 73 74 3b 20 |icious a|t best; |
|000026a0| 69 74 20 69 73 20 6e 6f | 77 20 67 72 6f 75 6e 64 |it is no|w ground|
|000026b0| 73 20 66 6f 72 20 62 72 | 65 61 6b 69 6e 67 2e 20 |s for br|eaking. |
|000026c0| 28 41 74 20 6c 65 61 73 | 74 20 77 69 74 68 20 72 |(At leas|t with r|
|000026d0| 65 73 70 65 63 74 20 74 | 6f 20 73 63 72 65 65 6e |espect t|o screen|
|000026e0| 20 64 69 6d 65 6e 73 69 | 6f 6e 73 2e 29 0d 42 79 | dimensi|ons.).By|
|000026f0| 20 74 68 65 20 77 61 79 | 2c 20 72 65 6d 65 6d 62 | the way|, rememb|
|00002700| 65 72 20 74 6f 20 74 61 | 6b 65 20 69 6e 74 6f 20 |er to ta|ke into |
|00002710| 61 63 63 6f 75 6e 74 20 | 74 68 65 20 6d 65 6e 75 |account |the menu|
|00002720| 20 62 61 72 20 68 65 69 | 67 68 74 20 77 68 65 6e | bar hei|ght when|
|00002730| 20 75 73 69 6e 67 20 74 | 68 69 73 20 72 65 63 74 | using t|his rect|
|00002740| 61 6e 67 6c 65 2e 20 4f | 6e 20 31 32 38 4b 20 52 |angle. O|n 128K R|
|00002750| 4f 4d 73 20 28 61 6e 64 | 20 6c 61 74 65 72 29 20 |OMs (and| later) |
|00002760| 79 6f 75 20 63 61 6e 20 | 75 73 65 20 74 68 65 20 |you can |use the |
|00002770| 6c 6f 77 2d 6d 65 6d 6f | 72 79 20 67 6c 6f 62 61 |low-memo|ry globa|
|00002780| 6c 20 6d 42 61 72 48 65 | 69 67 68 74 20 28 61 20 |l mBarHe|ight (a |
|00002790| 77 6f 72 64 20 61 74 20 | 24 42 41 41 29 2e 20 42 |word at |$BAA). B|
|000027a0| 75 74 20 73 69 6e 63 65 | 20 77 65 20 64 69 64 6e |ut since| we didn|
|000027b0| d5 74 20 70 72 6f 76 69 | 64 65 20 61 20 6c 6f 77 |.t provi|de a low|
|000027c0| 2d 6d 65 6d 6f 72 79 20 | 67 6c 6f 62 61 6c 20 66 |-memory |global f|
|000027d0| 6f 72 20 74 68 65 20 6d | 65 6e 75 20 62 61 72 20 |or the m|enu bar |
|000027e0| 68 65 69 67 68 74 20 69 | 6e 20 74 68 65 20 36 34 |height i|n the 64|
|000027f0| 4b 20 52 4f 4d 73 2c 20 | 79 6f 75 d5 6c 6c 20 68 |K ROMs, |you.ll h|
|00002800| 61 76 65 20 74 6f 20 68 | 61 72 64 20 63 6f 64 65 |ave to h|ard code|
|00002810| 20 69 74 20 74 6f 20 32 | 30 20 28 24 31 34 29 2e | it to 2|0 ($14).|
|00002820| 20 28 59 6f 75 d5 72 65 | 20 6e 6f 74 20 74 68 65 | (You.re| not the|
|00002830| 20 6f 6e 6c 79 20 6f 6e | 65 73 20 74 6f 20 66 6f | only on|es to fo|
|00002840| 72 67 65 74 20 74 68 65 | 20 66 75 74 75 72 65 20 |rget the| future |
|00002850| 68 6f 6c 64 73 20 63 68 | 61 6e 67 65 73 2e 29 0d |holds ch|anges.).|
|00002860| 48 6f 77 20 74 6f 20 66 | 69 6e 64 20 66 61 73 63 |How to f|ind fasc|
|00002870| 69 73 74 20 73 63 72 65 | 65 6e 69 73 6d 20 69 6e |ist scre|enism in|
|00002880| 20 63 75 72 72 65 6e 74 | 20 70 72 6f 67 72 61 6d | current| program|
|00002890| 73 0d 54 68 65 20 65 61 | 73 69 65 73 74 20 77 61 |s.The ea|siest wa|
|000028a0| 79 20 69 73 20 74 6f 20 | 65 78 65 72 63 69 73 65 |y is to |exercise|
|000028b0| 20 79 6f 75 72 20 70 72 | 6f 67 72 61 6d 20 6f 6e | your pr|ogram on|
|000028c0| 20 6f 6e 65 20 6f 66 20 | 74 68 65 20 55 6c 74 72 | one of |the Ultr|
|000028d0| 61 2d 4c 61 72 67 65 20 | 73 63 72 65 65 6e 20 4d |a-Large |screen M|
|000028e0| 61 63 69 6e 74 6f 73 68 | 65 73 2e 20 54 68 65 72 |acintosh|es. Ther|
|000028f0| 65 20 73 68 6f 75 6c 64 | 20 62 65 20 6e 6f 20 72 |e should| be no r|
|00002900| 65 73 74 72 69 63 74 69 | 6f 6e 73 20 6f 6e 20 73 |estricti|ons on s|
|00002910| 69 7a 69 6e 67 20 6f 72 | 20 6d 6f 76 69 6e 67 20 |izing or| moving |
|00002920| 74 68 65 20 77 69 6e 64 | 6f 77 73 2c 20 61 6e 64 |the wind|ows, and|
|00002930| 20 61 6c 6c 20 64 72 61 | 77 69 6e 67 20 73 68 6f | all dra|wing sho|
|00002940| 75 6c 64 20 68 61 76 65 | 20 6e 6f 20 70 72 6f 62 |uld have| no prob|
|00002950| 6c 65 6d 73 2e 20 49 66 | 20 74 68 65 72 65 20 61 |lems. If| there a|
|00002960| 72 65 20 61 6e 79 20 61 | 6e 6f 6d 61 6c 69 65 73 |re any a|nomalies|
|00002970| 20 69 6e 20 74 68 65 20 | 70 72 6f 67 72 61 6d d5 | in the |program.|
|00002980| 73 20 75 73 61 67 65 2c | 20 74 68 65 72 65 20 69 |s usage,| there i|
|00002990| 73 20 70 72 6f 62 61 62 | 6c 79 20 61 20 6c 75 72 |s probab|ly a lur|
|000029a0| 6b 69 6e 67 20 70 72 6f | 62 6c 65 6d 2e 20 41 6c |king pro|blem. Al|
|000029b0| 73 6f 2c 20 64 6f 20 61 | 20 67 6c 6f 62 61 6c 20 |so, do a| global |
|000029c0| 66 69 6e 64 20 69 6e 20 | 74 68 65 20 73 6f 75 72 |find in |the sour|
|000029d0| 63 65 20 63 6f 64 65 20 | 74 6f 20 73 65 65 20 69 |ce code |to see i|
|000029e0| 66 20 74 68 65 20 6e 75 | 6d 62 65 72 73 20 35 31 |f the nu|mbers 51|
|000029f0| 32 20 6f 72 20 33 34 32 | 20 6f 63 63 75 72 20 69 |2 or 342| occur i|
|00002a00| 6e 20 74 68 65 20 70 72 | 6f 67 72 61 6d 2e 20 49 |n the pr|ogram. I|
|00002a10| 66 20 73 6f 2c 20 61 6e | 64 20 69 66 20 74 68 65 |f so, an|d if the|
|00002a20| 79 20 61 72 65 20 69 6e | 20 72 65 66 65 72 65 6e |y are in| referen|
|00002a30| 63 65 20 74 6f 20 74 68 | 65 20 73 63 72 65 65 6e |ce to th|e screen|
|00002a40| 2c 20 65 78 63 69 73 65 | 20 74 68 65 6d 2e 0d 41 |, excise| them..A|
|00002a50| 73 73 75 6d 69 6e 67 20 | 74 68 65 20 73 63 72 65 |ssuming |the scre|
|00002a60| 65 6e 20 69 73 20 61 74 | 20 61 20 66 69 78 65 64 |en is at| a fixed|
|00002a70| 20 6c 6f 63 61 74 69 6f | 6e 0d 53 6f 6d 65 20 70 | locatio|n.Some p|
|00002a80| 72 6f 67 72 61 6d 73 20 | 75 73 65 20 61 20 66 69 |rograms |use a fi|
|00002a90| 78 65 64 20 73 63 72 65 | 65 6e 20 61 64 64 72 65 |xed scre|en addre|
|00002aa0| 73 73 2c 20 61 73 73 75 | 6d 69 6e 67 20 74 68 61 |ss, assu|ming tha|
|00002ab0| 74 20 74 68 65 20 73 63 | 72 65 65 6e 20 6c 6f 63 |t the sc|reen loc|
|00002ac0| 61 74 69 6f 6e 20 77 69 | 6c 6c 20 62 65 20 74 68 |ation wi|ll be th|
|00002ad0| 65 20 73 61 6d 65 20 6f | 6e 20 76 61 72 69 6f 75 |e same o|n variou|
|00002ae0| 73 20 69 6e 63 61 72 6e | 61 74 69 6f 6e 73 20 6f |s incarn|ations o|
|00002af0| 66 20 74 68 65 20 4d 61 | 63 69 6e 74 6f 73 68 2e |f the Ma|cintosh.|
|00002b00| 20 54 68 69 73 20 69 73 | 20 6e 6f 74 20 74 68 65 | This is| not the|
|00002b10| 20 63 61 73 65 2e 20 46 | 6f 72 20 65 78 61 6d 70 | case. F|or examp|
|00002b20| 6c 65 2c 20 74 68 65 20 | 73 63 72 65 65 6e 20 69 |le, the |screen i|
|00002b30| 73 20 6c 6f 63 61 74 65 | 64 20 61 74 20 6d 65 6d |s locate|d at mem|
|00002b40| 6f 72 79 20 6c 6f 63 61 | 74 69 6f 6e 20 24 31 41 |ory loca|tion $1A|
|00002b50| 37 30 30 20 6f 6e 20 61 | 20 31 32 38 4b 20 4d 61 |700 on a| 128K Ma|
|00002b60| 63 69 6e 74 6f 73 68 2c | 20 61 74 20 24 37 41 37 |cintosh,| at $7A7|
|00002b70| 30 30 20 6f 6e 20 61 20 | 35 31 32 4b 20 4d 61 63 |00 on a |512K Mac|
|00002b80| 69 6e 74 6f 73 68 2c 20 | 61 74 20 24 46 38 30 30 |intosh, |at $F800|
|00002b90| 30 20 6f 6e 20 74 68 65 | 20 4d 61 63 69 6e 74 6f |0 on the| Macinto|
|00002ba0| 73 68 20 58 4c 2c 20 61 | 6e 64 20 61 74 20 24 46 |sh XL, a|nd at $F|
|00002bb0| 41 37 30 30 20 6f 6e 20 | 74 68 65 20 4d 61 63 69 |A700 on |the Maci|
|00002bc0| 6e 74 6f 73 68 20 50 6c | 75 73 2e 0d 57 68 79 20 |ntosh Pl|us..Why |
|00002bd0| 69 74 d5 73 20 42 61 64 | 0d 57 68 65 6e 20 61 20 |it.s Bad|.When a |
|00002be0| 70 72 6f 67 72 61 6d 20 | 72 65 6c 69 65 73 20 75 |program |relies u|
|00002bf0| 70 6f 6e 20 74 68 65 20 | 73 63 72 65 65 6e 20 62 |pon the |screen b|
|00002c00| 65 69 6e 67 20 69 6e 20 | 61 20 66 69 78 65 64 20 |eing in |a fixed |
|00002c10| 6c 6f 63 61 74 69 6f 6e | 2c 20 4d 75 72 70 68 79 |location|, Murphy|
|00002c20| d5 73 20 4c 61 77 20 64 | 69 63 74 61 74 65 73 20 |.s Law d|ictates |
|00002c30| 74 68 61 74 20 61 6e 20 | 75 6e 6b 6e 6f 77 69 6e |that an |unknowin|
|00002c40| 67 20 75 73 65 72 20 77 | 69 6c 6c 20 72 75 6e 20 |g user w|ill run |
|00002c50| 69 74 20 75 70 6f 6e 20 | 61 20 63 6f 6d 70 75 74 |it upon |a comput|
|00002c60| 65 72 20 77 69 74 68 20 | 74 68 65 20 73 63 72 65 |er with |the scre|
|00002c70| 65 6e 20 69 6e 20 61 20 | 64 69 66 66 65 72 65 6e |en in a |differen|
|00002c80| 74 20 6c 6f 63 61 74 69 | 6f 6e 2e 20 54 68 69 73 |t locati|on. This|
|00002c90| 20 75 73 75 61 6c 6c 79 | 20 63 61 75 73 65 73 20 | usually| causes |
|00002ca0| 74 68 65 20 73 79 73 74 | 65 6d 20 74 6f 20 63 72 |the syst|em to cr|
|00002cb0| 61 73 68 2c 20 73 69 6e | 63 65 20 74 68 65 20 6f |ash, sin|ce the o|
|00002cc0| 66 66 65 6e 64 69 6e 67 | 20 70 72 6f 67 72 61 6d |ffending| program|
|00002cd0| 20 77 69 6c 6c 20 77 72 | 69 74 65 20 74 6f 20 6d | will wr|ite to m|
|00002ce0| 65 6d 6f 72 79 20 74 68 | 61 74 20 77 61 73 20 75 |emory th|at was u|
|00002cf0| 73 65 64 20 66 6f 72 20 | 73 6f 6d 65 74 68 69 6e |sed for |somethin|
|00002d00| 67 20 69 6d 70 6f 72 74 | 61 6e 74 2e 20 50 72 6f |g import|ant. Pro|
|00002d10| 67 72 61 6d 73 20 74 68 | 61 74 20 63 72 61 73 68 |grams th|at crash|
|00002d20| 20 68 61 76 65 20 62 65 | 65 6e 20 70 72 6f 76 65 | have be|en prove|
|00002d30| 6e 20 74 6f 20 62 65 20 | 6c 65 73 73 20 75 73 65 |n to be |less use|
|00002d40| 66 75 6c 20 74 68 61 6e | 20 74 68 6f 73 65 20 74 |ful than| those t|
|00002d50| 68 61 74 20 64 6f 6e d5 | 74 2e 0d 48 6f 77 20 74 |hat don.|t..How t|
|00002d60| 6f 20 61 76 6f 69 64 20 | 62 65 69 6e 67 20 61 20 |o avoid |being a |
|00002d70| 62 61 73 65 20 73 63 72 | 65 65 6e 65 72 0d 53 75 |base scr|eener.Su|
|00002d80| 66 66 69 63 65 20 69 74 | 20 74 6f 20 73 61 79 20 |ffice it| to say |
|00002d90| 74 68 61 74 20 74 68 65 | 72 65 20 69 73 20 6e 6f |that the|re is no|
|00002da0| 20 77 61 79 20 74 68 61 | 74 20 74 68 65 20 61 64 | way tha|t the ad|
|00002db0| 64 72 65 73 73 20 6f 66 | 20 74 68 65 20 73 63 72 |dress of| the scr|
|00002dc0| 65 65 6e 20 77 69 6c 6c | 20 72 65 6d 61 69 6e 20 |een will| remain |
|00002dd0| 73 74 61 74 69 63 2c 20 | 62 75 74 20 74 68 65 72 |static, |but ther|
|00002de0| 65 20 61 72 65 20 72 61 | 72 65 20 6f 63 63 61 73 |e are ra|re occas|
|00002df0| 69 6f 6e 73 20 77 68 65 | 72 65 20 69 74 20 69 73 |ions whe|re it is|
|00002e00| 20 6e 65 63 65 73 73 61 | 72 79 20 74 6f 20 67 6f | necessa|ry to go|
|00002e10| 20 64 69 72 65 63 74 6c | 79 20 74 6f 20 74 68 65 | directl|y to the|
|00002e20| 20 73 63 72 65 65 6e 20 | 6d 65 6d 6f 72 79 2e 20 | screen |memory. |
|00002e30| 4f 6e 20 74 68 65 73 65 | 20 6f 63 63 61 73 69 6f |On these| occasio|
|00002e40| 6e 73 2c 20 74 68 65 72 | 65 20 61 72 65 20 62 61 |ns, ther|e are ba|
|00002e50| 64 20 77 61 79 73 20 61 | 6e 64 20 6e 6f 74 2d 61 |d ways a|nd not-a|
|00002e60| 73 2d 62 61 64 20 77 61 | 79 73 20 74 6f 20 64 6f |s-bad wa|ys to do|
|00002e70| 20 69 74 2e 20 41 20 62 | 61 64 20 77 61 79 3a 0d | it. A b|ad way:.|
|00002e80| 09 0d 09 6d 79 53 63 72 | 65 65 6e 42 61 73 65 20 |...myScr|eenBase |
|00002e90| 3a 3d 20 50 6f 69 6e 74 | 65 72 20 28 24 37 41 37 |:= Point|er ($7A7|
|00002ea0| 30 30 29 3b 20 20 7b 20 | 6e 6f 74 20 67 6f 6f 64 |00); { |not good|
|00002eb0| 2e 20 20 48 61 72 64 2d | 63 6f 64 65 64 20 6e 75 |. Hard-|coded nu|
|00002ec0| 6d 62 65 72 2e 20 7d 0d | 41 20 6e 6f 74 2d 61 73 |mber. }.|A not-as|
|00002ed0| 2d 62 61 64 20 77 61 79 | 3a 0d 09 49 6e 69 74 47 |-bad way|:..InitG|
|00002ee0| 72 61 66 28 40 74 68 65 | 50 6f 72 74 29 3b 20 20 |raf(@the|Port); |
|00002ef0| 20 7b 20 64 6f 20 74 68 | 69 73 20 6f 6e 6c 79 20 | { do th|is only |
|00002f00| 6f 6e 63 65 20 69 6e 20 | 61 20 70 72 6f 67 72 61 |once in |a progra|
|00002f10| 6d 2e 20 7d 0d 09 c9 0d | 09 6d 79 53 63 72 65 65 |m. }....|.myScree|
|00002f20| 6e 42 61 73 65 20 3a 3d | 20 73 63 72 65 65 6e 42 |nBase :=| screenB|
|00002f30| 69 74 73 2e 62 61 73 65 | 41 64 64 72 3b 20 20 7b |its.base|Addr; {|
|00002f40| 20 47 6f 6f 64 2e 20 20 | 41 6c 77 61 79 73 20 77 | Good. |Always w|
|00002f50| 6f 72 6b 73 2e 20 7d 0d | 09 09 20 20 20 20 20 20 |orks. }.|.. |
|00002f60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 09 20 | | . |
|00002f70| 20 20 20 20 20 7b 59 65 | 74 20 61 6e 6f 74 68 65 | {Ye|t anothe|
|00002f80| 72 20 51 75 69 63 6b 44 | 72 61 77 20 67 6c 6f 62 |r QuickD|raw glob|
|00002f90| 61 6c 20 76 61 72 69 61 | 62 6c 65 7d 0d 55 73 69 |al varia|ble}.Usi|
|00002fa0| 6e 67 20 74 68 65 20 6c | 61 74 74 65 72 20 61 70 |ng the l|atter ap|
|00002fb0| 70 72 6f 61 63 68 20 69 | 73 20 67 75 61 72 61 6e |proach i|s guaran|
|00002fc0| 74 65 65 64 20 74 6f 20 | 77 6f 72 6b 2c 20 73 69 |teed to |work, si|
|00002fd0| 6e 63 65 20 51 75 69 63 | 6b 44 72 61 77 20 68 61 |nce Quic|kDraw ha|
|00002fe0| 73 20 74 6f 20 6b 6e 6f | 77 20 77 68 65 72 65 20 |s to kno|w where |
|00002ff0| 74 6f 20 64 72 61 77 2c | 20 61 6e 64 20 74 68 65 |to draw,| and the|
|00003000| 20 6f 70 65 72 61 74 69 | 6e 67 20 73 79 73 74 65 | operati|ng syste|
|00003010| 6d 20 74 65 6c 6c 73 20 | 51 75 69 63 6b 44 72 61 |m tells |QuickDra|
|00003020| 77 20 77 68 65 72 65 20 | 74 68 65 20 73 63 72 65 |w where |the scre|
|00003030| 65 6e 20 63 61 6e 20 62 | 65 20 66 6f 75 6e 64 2e |en can b|e found.|
|00003040| 20 57 68 65 6e 20 69 6e | 20 64 6f 75 62 74 2c 20 | When in| doubt, |
|00003050| 61 73 6b 20 51 75 69 63 | 6b 44 72 61 77 2e 20 54 |ask Quic|kDraw. T|
|00003060| 68 69 73 20 77 69 6c 6c | 20 77 6f 72 6b 20 6f 6e |his will| work on|
|00003070| 20 4d 61 63 69 6e 74 6f | 73 68 20 63 6f 6d 70 75 | Macinto|sh compu|
|00003080| 74 65 72 73 20 66 72 6f | 6d 20 6e 6f 77 20 75 6e |ters fro|m now un|
|00003090| 74 69 6c 20 66 6f 72 65 | 76 65 72 2c 20 73 6f 20 |til fore|ver, so |
|000030a0| 69 66 20 79 6f 75 20 75 | 73 65 20 74 68 69 73 20 |if you u|se this |
|000030b0| 61 70 70 72 6f 61 63 68 | 20 79 6f 75 20 77 6f 6e |approach| you won|
|000030c0| d5 74 20 68 61 76 65 20 | 74 6f 20 72 65 76 69 73 |.t have |to revis|
|000030d0| 65 20 79 6f 75 72 20 70 | 72 6f 67 72 61 6d 20 6a |e your p|rogram j|
|000030e0| 75 73 74 20 62 65 63 61 | 75 73 65 20 74 68 65 20 |ust beca|use the |
|000030f0| 73 63 72 65 65 6e 20 6d | 6f 76 65 64 20 69 6e 20 |screen m|oved in |
|00003100| 6d 65 6d 6f 72 79 2e 0d | 49 66 20 79 6f 75 20 68 |memory..|If you h|
|00003110| 61 76 65 20 61 20 70 72 | 6f 67 72 61 6d 20 28 73 |ave a pr|ogram (s|
|00003120| 75 63 68 20 61 73 20 61 | 6e 20 49 4e 49 54 29 20 |uch as a|n INIT) |
|00003130| 74 68 61 74 20 63 61 6e | 6e 6f 74 20 72 65 6c 79 |that can|not rely|
|00003140| 20 75 70 6f 6e 20 51 75 | 69 63 6b 44 72 61 77 20 | upon Qu|ickDraw |
|00003150| 62 65 69 6e 67 20 69 6e | 69 74 69 61 6c 69 7a 65 |being in|itialize|
|00003160| 64 20 28 76 69 61 20 49 | 6e 69 74 47 72 61 66 29 |d (via I|nitGraf)|
|00003170| 2c 20 74 68 65 6e 20 69 | 74 20 69 73 20 70 6f 73 |, then i|t is pos|
|00003180| 73 69 62 6c 65 20 74 6f | 20 75 73 65 20 74 68 65 |sible to| use the|
|00003190| 20 53 63 72 6e 42 61 73 | 65 20 6c 6f 77 2d 6d 65 | ScrnBas|e low-me|
|000031a0| 6d 6f 72 79 20 67 6c 6f | 62 61 6c 20 76 61 72 69 |mory glo|bal vari|
|000031b0| 61 62 6c 65 20 28 61 20 | 6c 6f 6e 67 20 77 6f 72 |able (a |long wor|
|000031c0| 64 20 61 74 20 24 38 32 | 34 29 2e 20 54 68 69 73 |d at $82|4). This|
|000031d0| 20 6d 65 74 68 6f 64 20 | 72 75 6e 73 20 61 20 64 | method |runs a d|
|000031e0| 69 73 74 61 6e 74 20 73 | 65 63 6f 6e 64 20 74 6f |istant s|econd to|
|000031f0| 20 61 73 6b 69 6e 67 20 | 51 75 69 63 6b 44 72 61 | asking |QuickDra|
|00003200| 77 2c 20 62 75 74 20 69 | 73 20 73 6f 6d 65 74 69 |w, but i|s someti|
|00003210| 6d 65 73 20 6e 65 63 65 | 73 73 61 72 79 2e 0d 48 |mes nece|ssary..H|
|00003220| 6f 77 20 74 6f 20 66 69 | 6e 64 20 62 61 73 65 20 |ow to fi|nd base |
|00003230| 73 63 72 65 65 6e 65 72 | 73 0d 54 68 65 20 65 61 |screener|s.The ea|
|00003240| 73 69 65 73 74 20 77 61 | 79 20 74 6f 20 66 69 6e |siest wa|y to fin|
|00003250| 64 20 62 61 73 65 20 73 | 63 72 65 65 6e 65 72 73 |d base s|creeners|
|00003260| 20 69 73 20 74 6f 20 72 | 75 6e 20 74 68 65 20 6f | is to r|un the o|
|00003270| 66 66 65 6e 64 69 6e 67 | 20 70 72 6f 67 72 61 6d |ffending| program|
|00003280| 20 6f 6e 20 6d 61 63 68 | 69 6e 65 73 20 74 68 61 | on mach|ines tha|
|00003290| 74 20 68 61 76 65 20 64 | 69 66 66 65 72 65 6e 74 |t have d|ifferent|
|000032a0| 20 73 63 72 65 65 6e 20 | 61 64 64 72 65 73 73 65 | screen |addresse|
|000032b0| 73 2e 20 49 66 20 61 6e | 79 20 61 64 64 72 65 73 |s. If an|y addres|
|000032c0| 73 65 73 20 61 72 65 20 | 62 65 69 6e 67 20 75 73 |ses are |being us|
|000032d0| 65 64 20 69 6e 20 61 20 | 62 61 73 65 20 6d 61 6e |ed in a |base man|
|000032e0| 6e 65 72 2c 20 74 68 65 | 20 73 79 73 74 65 6d 20 |ner, the| system |
|000032f0| 77 69 6c 6c 20 75 73 75 | 61 6c 6c 79 20 63 72 61 |will usu|ally cra|
|00003300| 73 68 2e 20 54 68 65 20 | 6f 66 66 65 6e 64 69 6e |sh. The |offendin|
|00003310| 67 20 70 72 6f 67 72 61 | 6d 20 6d 61 79 20 61 6c |g progra|m may al|
|00003320| 73 6f 20 6f 63 63 61 73 | 69 6f 6e 61 6c 6c 79 20 |so occas|ionally |
|00003330| 72 65 66 75 73 65 20 74 | 6f 20 64 72 61 77 2e 20 |refuse t|o draw. |
|00003340| 53 6f 6d 65 20 70 72 6f | 67 72 61 6d 73 20 61 66 |Some pro|grams af|
|00003350| 66 6c 69 63 74 65 64 20 | 77 69 74 68 20 74 68 69 |flicted |with thi|
|00003360| 73 20 70 72 6f 62 6c 65 | 6d 20 6d 61 79 20 61 6c |s proble|m may al|
|00003370| 73 6f 20 68 61 6e 67 20 | 74 68 65 20 63 6f 6d 70 |so hang |the comp|
|00003380| 75 74 65 72 20 28 73 6f | 6d 65 74 69 6d 65 73 20 |uter (so|metimes |
|00003390| 6b 6e 6f 77 6e 20 61 73 | 20 61 63 63 65 73 73 69 |known as| accessi|
|000033a0| 6e 67 20 66 75 6e 6e 79 | 20 73 70 61 63 65 29 2e |ng funny| space).|
|000033b0| 20 41 6c 73 6f 2c 20 64 | 6f 20 61 20 67 6c 6f 62 | Also, d|o a glob|
|000033c0| 61 6c 20 66 69 6e 64 20 | 6f 6e 20 74 68 65 20 73 |al find |on the s|
|000033d0| 6f 75 72 63 65 20 63 6f | 64 65 20 74 6f 20 6c 6f |ource co|de to lo|
|000033e0| 6f 6b 20 66 6f 72 20 6e | 75 6d 62 65 72 73 20 6c |ok for n|umbers l|
|000033f0| 69 6b 65 20 24 37 41 37 | 30 30 20 6f 72 20 24 31 |ike $7A7|00 or $1|
|00003400| 41 37 30 30 2e 20 57 68 | 65 6e 20 66 6f 75 6e 64 |A700. Wh|en found|
|00003410| 2c 20 65 78 65 72 63 69 | 73 65 20 63 61 75 74 69 |, exerci|se cauti|
|00003420| 6f 6e 20 77 68 69 6c 65 | 20 61 6c 74 65 72 69 6e |on while| alterin|
|00003430| 67 20 74 68 65 20 6f 66 | 66 65 6e 64 69 6e 67 20 |g the of|fending |
|00003440| 6c 69 6e 65 73 2e 0d 41 | 73 73 75 6d 69 6e 67 20 |lines..A|ssuming |
|00003450| 74 68 61 74 20 72 6f 77 | 62 79 74 65 73 20 69 73 |that row|bytes is|
|00003460| 20 65 71 75 61 6c 20 74 | 6f 20 74 68 65 20 77 69 | equal t|o the wi|
|00003470| 64 74 68 20 6f 66 20 74 | 68 65 20 73 63 72 65 65 |dth of t|he scree|
|00003480| 6e 0d 41 63 63 6f 72 64 | 69 6e 67 20 74 6f 20 74 |n.Accord|ing to t|
|00003490| 68 65 20 64 65 66 69 6e | 69 74 69 6f 6e 20 6f 66 |he defin|ition of|
|000034a0| 20 61 20 62 69 74 4d 61 | 70 20 66 6f 75 6e 64 20 | a bitMa|p found |
|000034b0| 69 6e 20 49 6e 73 69 64 | 65 20 4d 61 63 69 6e 74 |in Insid|e Macint|
|000034c0| 6f 73 68 20 28 70 20 49 | 2d 31 34 34 29 2c 20 79 |osh (p I|-144), y|
|000034d0| 6f 75 20 63 61 6e 20 73 | 65 65 20 74 68 61 74 20 |ou can s|ee that |
|000034e0| 72 6f 77 42 79 74 65 73 | 20 69 73 20 74 68 65 20 |rowBytes| is the |
|000034f0| 6e 75 6d 62 65 72 20 6f | 66 20 61 63 74 75 61 6c |number o|f actual|
|00003500| 20 62 79 74 65 73 20 69 | 6e 20 6d 65 6d 6f 72 79 | bytes i|n memory|
|00003510| 20 74 68 61 74 20 61 72 | 65 20 75 73 65 64 20 74 | that ar|e used t|
|00003520| 6f 20 64 65 74 65 72 6d | 69 6e 65 20 74 68 65 20 |o determ|ine the |
|00003530| 62 69 74 4d 61 70 2e 20 | 57 65 20 6b 6e 6f 77 20 |bitMap. |We know |
|00003540| 74 68 65 20 73 63 72 65 | 65 6e 20 69 73 20 6a 75 |the scre|en is ju|
|00003550| 73 74 20 61 20 62 69 67 | 20 68 75 6e 6b 20 6f 66 |st a big| hunk of|
|00003560| 20 6d 65 6d 6f 72 79 2c | 20 61 6e 64 20 77 65 20 | memory,| and we |
|00003570| 6b 6e 6f 77 20 74 68 61 | 74 20 51 75 69 63 6b 44 |know tha|t QuickD|
|00003580| 72 61 77 20 75 73 65 73 | 20 74 68 61 74 20 6d 65 |raw uses| that me|
|00003590| 6d 6f 72 79 20 61 73 20 | 61 20 62 69 74 4d 61 70 |mory as |a bitMap|
|000035a0| 2e 20 72 6f 77 42 79 74 | 65 73 20 61 63 63 6f 6d |. rowByt|es accom|
|000035b0| 70 6c 69 73 68 65 73 20 | 74 68 65 20 74 72 61 6e |plishes |the tran|
|000035c0| 73 6c 61 74 69 6f 6e 20 | 6f 66 20 61 20 62 69 67 |slation |of a big|
|000035d0| 20 68 75 6e 6b 20 6f 66 | 20 6d 65 6d 6f 72 79 20 | hunk of| memory |
|000035e0| 69 6e 74 6f 20 61 20 62 | 69 74 4d 61 70 2e 20 54 |into a b|itMap. T|
|000035f0| 6f 20 64 6f 20 74 68 69 | 73 2c 20 72 6f 77 42 79 |o do thi|s, rowBy|
|00003600| 74 65 73 20 74 65 6c 6c | 73 20 74 68 65 20 73 79 |tes tell|s the sy|
|00003610| 73 74 65 6d 20 68 6f 77 | 20 6c 6f 6e 67 20 61 20 |stem how| long a |
|00003620| 67 69 76 65 6e 20 72 6f | 77 20 69 73 20 69 6e 20 |given ro|w is in |
|00003630| 6d 65 6d 6f 72 79 20 61 | 6e 64 2c 20 6d 6f 72 65 |memory a|nd, more|
|00003640| 20 69 6d 70 6f 72 74 61 | 6e 74 6c 79 2c 20 77 68 | importa|ntly, wh|
|00003650| 65 72 65 20 69 6e 20 6d | 65 6d 6f 72 79 20 74 68 |ere in m|emory th|
|00003660| 65 20 6e 65 78 74 20 72 | 6f 77 20 73 74 61 72 74 |e next r|ow start|
|00003670| 73 2e 20 46 6f 72 20 63 | 6f 6e 76 65 6e 74 69 6f |s. For c|onventio|
|00003680| 6e 61 6c 20 4d 61 63 69 | 6e 74 6f 73 68 65 73 2c |nal Maci|ntoshes,|
|00003690| 20 72 6f 77 42 79 74 65 | 73 20 28 62 79 74 65 73 | rowByte|s (bytes|
|000036a0| 20 70 65 72 20 52 6f 77 | 29 20 2a 20 38 20 28 50 | per Row|) * 8 (P|
|000036b0| 69 78 65 6c 73 20 70 65 | 72 20 42 79 74 65 29 20 |ixels pe|r Byte) |
|000036c0| 67 69 76 65 73 20 74 68 | 65 20 66 69 6e 61 6c 20 |gives th|e final |
|000036d0| 68 6f 72 69 7a 6f 6e 74 | 61 6c 20 77 69 64 74 68 |horizont|al width|
|000036e0| 20 6f 66 20 74 68 65 20 | 73 63 72 65 65 6e 20 61 | of the |screen a|
|000036f0| 73 20 50 69 78 65 6c 73 | 20 70 65 72 20 52 6f 77 |s Pixels| per Row|
|00003700| 2e 20 54 68 69 73 20 64 | 6f 65 73 20 6e 6f 74 20 |. This d|oes not |
|00003710| 68 61 76 65 20 74 6f 20 | 62 65 20 74 68 65 20 63 |have to |be the c|
|00003720| 61 73 65 2e 20 49 74 20 | 69 73 20 70 6f 73 73 69 |ase. It |is possi|
|00003730| 62 6c 65 20 74 6f 20 68 | 61 76 65 20 61 20 4d 61 |ble to h|ave a Ma|
|00003740| 63 69 6e 74 6f 73 68 20 | 73 63 72 65 65 6e 20 77 |cintosh |screen w|
|00003750| 68 65 72 65 20 74 68 65 | 20 72 6f 77 42 79 74 65 |here the| rowByte|
|00003760| 73 20 65 78 74 65 6e 64 | 73 20 62 65 79 6f 6e 64 |s extend|s beyond|
|00003770| 20 77 68 61 74 20 69 73 | 20 61 63 74 75 61 6c 6c | what is| actuall|
|00003780| 79 20 76 69 73 69 62 6c | 65 20 6f 6e 20 74 68 65 |y visibl|e on the|
|00003790| 20 73 63 72 65 65 6e 2e | 20 59 6f 75 20 63 61 6e | screen.| You can|
|000037a0| 20 74 68 69 6e 6b 20 6f | 66 20 69 74 20 61 73 20 | think o|f it as |
|000037b0| 68 61 76 69 6e 67 20 74 | 68 65 20 73 63 72 65 65 |having t|he scree|
|000037c0| 6e 20 6c 6f 6f 6b 69 6e | 67 20 69 6e 20 6f 6e 20 |n lookin|g in on |
|000037d0| 61 20 6c 61 72 67 65 72 | 20 62 69 74 4d 61 70 2e |a larger| bitMap.|
|000037e0| 20 44 69 61 67 72 61 6d | 6d 61 74 69 63 61 6c 6c | Diagram|maticall|
|000037f0| 79 2c 20 69 74 20 6d 69 | 67 68 74 20 6c 6f 6f 6b |y, it mi|ght look|
|00003800| 20 6c 69 6b 65 3a 0d 57 | 69 74 68 20 61 6e 20 55 | like:.W|ith an U|
|00003810| 6c 74 72 61 2d 4c 61 72 | 67 65 20 73 63 72 65 65 |ltra-Lar|ge scree|
|00003820| 6e 2c 20 74 68 65 20 6e | 75 6d 62 65 72 20 6f 66 |n, the n|umber of|
|00003830| 20 62 79 74 65 73 20 75 | 73 65 64 20 66 6f 72 20 | bytes u|sed for |
|00003840| 73 63 72 65 65 6e 20 6d | 65 6d 6f 72 79 20 6d 61 |screen m|emory ma|
|00003850| 79 20 62 65 20 69 6e 20 | 74 68 65 20 35 30 30 2c |y be in |the 500,|
|00003860| 30 30 30 20 62 79 74 65 | 20 72 61 6e 67 65 2e 20 |000 byte| range. |
|00003870| 57 68 65 6e 65 76 65 72 | 20 63 61 6c 63 75 6c 61 |Whenever| calcula|
|00003880| 74 69 6f 6e 73 20 61 72 | 65 20 62 65 69 6e 67 20 |tions ar|e being |
|00003890| 6d 61 64 65 20 74 6f 20 | 66 69 6e 64 20 76 61 72 |made to |find var|
|000038a0| 69 6f 75 73 20 6c 6f 63 | 61 74 69 6f 6e 73 20 69 |ious loc|ations i|
|000038b0| 6e 20 74 68 65 20 73 63 | 72 65 65 6e 2c 20 74 68 |n the sc|reen, th|
|000038c0| 65 20 76 61 72 69 61 62 | 6c 65 73 20 75 73 65 64 |e variab|les used|
|000038d0| 20 73 68 6f 75 6c 64 20 | 62 65 20 61 62 6c 65 20 | should |be able |
|000038e0| 74 6f 20 68 61 6e 64 6c | 65 20 6c 61 72 67 65 72 |to handl|e larger|
|000038f0| 20 73 63 72 65 65 6e 20 | 73 69 7a 65 73 2e 20 46 | screen |sizes. F|
|00003900| 6f 72 20 65 78 61 6d 70 | 6c 65 2c 20 61 20 31 36 |or examp|le, a 16|
|00003910| 20 62 69 74 20 49 6e 74 | 65 67 65 72 20 77 69 6c | bit Int|eger wil|
|00003920| 6c 20 6e 6f 74 20 62 65 | 20 61 62 6c 65 20 74 6f |l not be| able to|
|00003930| 20 68 6f 6c 64 20 74 68 | 65 20 35 30 30 2c 30 30 | hold th|e 500,00|
|00003940| 30 20 6e 75 6d 62 65 72 | 2c 20 73 6f 20 61 20 4c |0 number|, so a L|
|00003950| 6f 6e 67 49 6e 74 20 77 | 6f 75 6c 64 20 62 65 20 |ongInt w|ould be |
|00003960| 72 65 71 75 69 72 65 64 | 2e 20 20 44 6f 20 6e 6f |required|. Do no|
|00003970| 74 20 61 73 73 75 6d 65 | 20 74 68 61 74 20 74 68 |t assume| that th|
|00003980| 65 20 73 63 72 65 65 6e | 20 73 69 7a 65 20 69 73 |e screen| size is|
|00003990| 20 32 31 2c 38 38 38 20 | 62 79 74 65 73 20 6c 6f | 21,888 |bytes lo|
|000039a0| 6e 67 2e 20 20 62 69 74 | 4d 61 70 73 20 63 61 6e |ng. bit|Maps can|
|000039b0| 20 62 65 20 6c 61 72 67 | 65 72 20 74 68 61 6e 20 | be larg|er than |
|000039c0| 33 32 4b 20 6f 72 20 36 | 34 4b 2e 0d 57 68 79 20 |32K or 6|4K..Why |
|000039d0| 69 74 d5 73 20 42 61 64 | 0d 50 72 6f 67 72 61 6d |it.s Bad|.Program|
|000039e0| 73 20 74 68 61 74 20 61 | 73 73 75 6d 65 20 74 68 |s that a|ssume th|
|000039f0| 61 74 20 61 6c 6c 20 6f | 66 20 74 68 65 20 62 79 |at all o|f the by|
|00003a00| 74 65 73 20 69 6e 20 61 | 20 72 6f 77 20 61 72 65 |tes in a| row are|
|00003a10| 20 76 69 73 69 62 6c 65 | 20 6d 61 79 20 6d 61 6b | visible| may mak|
|00003a20| 65 20 62 61 64 20 63 61 | 6c 63 75 6c 61 74 69 6f |e bad ca|lculatio|
|00003a30| 6e 73 2c 20 63 61 75 73 | 69 6e 67 20 64 72 61 77 |ns, caus|ing draw|
|00003a40| 69 6e 67 20 72 6f 75 74 | 69 6e 65 73 20 74 6f 20 |ing rout|ines to |
|00003a50| 70 72 6f 64 75 63 65 20 | 75 6e 75 73 75 61 6c 2c |produce |unusual,|
|00003a60| 20 61 6e 64 20 75 6e 72 | 65 61 64 61 62 6c 65 2c | and unr|eadable,|
|00003a70| 20 72 65 73 75 6c 74 73 | 2e 20 20 41 6c 73 6f 2c | results|. Also,|
|00003a80| 20 70 72 6f 67 72 61 6d | 73 20 74 68 61 74 20 75 | program|s that u|
|00003a90| 73 65 20 74 68 65 20 72 | 6f 77 42 79 74 65 73 20 |se the r|owBytes |
|00003aa0| 74 6f 20 66 69 67 75 72 | 65 20 6f 75 74 20 74 68 |to figur|e out th|
|00003ab0| 65 20 77 69 64 74 68 20 | 6f 66 20 74 68 65 20 73 |e width |of the s|
|00003ac0| 63 72 65 65 6e 20 72 65 | 63 74 61 6e 67 6c 65 20 |creen re|ctangle |
|00003ad0| 77 69 6c 6c 20 66 69 6e | 64 20 74 68 61 74 20 74 |will fin|d that t|
|00003ae0| 68 65 69 72 20 63 61 6c | 63 75 6c 61 74 65 64 20 |heir cal|culated |
|00003af0| 72 65 63 74 61 6e 67 6c | 65 20 69 73 20 6e 6f 74 |rectangl|e is not|
|00003b00| 20 74 68 65 20 72 65 61 | 6c 20 73 63 72 65 65 6e | the rea|l screen|
|00003b10| 42 69 74 73 2e 42 6f 75 | 6e 64 73 2e 20 20 44 72 |Bits.Bou|nds. Dr|
|00003b20| 61 77 69 6e 67 20 69 6e | 74 6f 20 61 72 65 61 73 |awing in|to areas|
|00003b30| 20 74 68 61 74 20 61 72 | 65 20 6e 6f 74 20 76 69 | that ar|e not vi|
|00003b40| 73 69 62 6c 65 20 77 69 | 6c 6c 20 6e 6f 74 20 6e |sible wi|ll not n|
|00003b50| 65 63 65 73 73 61 72 69 | 6c 79 20 63 72 61 73 68 |ecessari|ly crash|
|00003b60| 20 74 68 65 20 63 6f 6d | 70 75 74 65 72 2c 20 62 | the com|puter, b|
|00003b70| 75 74 20 69 74 20 77 69 | 6c 6c 20 70 72 6f 62 61 |ut it wi|ll proba|
|00003b80| 62 6c 79 20 67 69 76 65 | 20 65 72 72 6f 6e 65 6f |bly give| erroneo|
|00003b90| 75 73 20 72 65 73 75 6c | 74 73 2c 20 61 6e 64 20 |us resul|ts, and |
|00003ba0| 64 69 73 70 6c 61 79 73 | 20 74 68 61 74 20 64 6f |displays| that do|
|00003bb0| 6e d5 74 20 6d 61 74 63 | 68 20 74 68 65 20 6e 6f |n.t matc|h the no|
|00003bc0| 72 6d 61 6c 20 6f 75 74 | 70 75 74 20 6f 66 20 74 |rmal out|put of t|
|00003bd0| 68 65 20 70 72 6f 67 72 | 61 6d 2e 0d 50 72 6f 67 |he progr|am..Prog|
|00003be0| 72 61 6d 73 20 74 68 61 | 74 20 61 73 73 75 6d 65 |rams tha|t assume|
|00003bf0| 20 74 68 61 74 20 74 68 | 65 20 6e 75 6d 62 65 72 | that th|e number|
|00003c00| 20 6f 66 20 62 79 74 65 | 73 20 69 6e 20 74 68 65 | of byte|s in the|
|00003c10| 20 73 63 72 65 65 6e 20 | 6d 65 6d 6f 72 79 20 77 | screen |memory w|
|00003c20| 69 6c 6c 20 62 65 20 6c | 65 73 73 20 74 68 61 6e |ill be l|ess than|
|00003c30| 20 33 32 37 36 38 20 6d | 61 79 20 68 61 76 65 20 | 32768 m|ay have |
|00003c40| 70 72 6f 62 6c 65 6d 73 | 20 64 72 61 77 69 6e 67 |problems| drawing|
|00003c50| 20 69 6e 74 6f 20 55 6c | 74 72 61 2d 4c 61 72 67 | into Ul|tra-Larg|
|00003c60| 65 20 73 63 72 65 65 6e | 73 2c 20 73 69 6e 63 65 |e screen|s, since|
|00003c70| 20 74 68 6f 73 65 20 73 | 63 72 65 65 6e 73 20 77 | those s|creens w|
|00003c80| 69 6c 6c 20 6f 66 74 65 | 6e 20 68 61 76 65 20 6d |ill ofte|n have m|
|00003c90| 6f 72 65 20 6d 65 6d 6f | 72 79 20 74 68 61 6e 20 |ore memo|ry than |
|00003ca0| 61 20 6e 6f 72 6d 61 6c | 20 4d 61 63 69 6e 74 6f |a normal| Macinto|
|00003cb0| 73 68 20 73 63 72 65 65 | 6e 2e 20 20 54 68 65 73 |sh scree|n. Thes|
|00003cc0| 65 20 70 61 72 74 69 63 | 75 6c 61 72 20 70 72 6f |e partic|ular pro|
|00003cd0| 62 6c 65 6d 73 20 64 6f | 20 6e 6f 74 20 65 76 69 |blems do| not evi|
|00003ce0| 64 65 6e 63 65 20 74 68 | 65 6d 73 65 6c 76 65 73 |dence th|emselves|
|00003cf0| 20 62 79 20 63 72 61 73 | 68 69 6e 67 20 74 68 65 | by cras|hing the|
|00003d00| 20 73 79 73 74 65 6d 2e | 20 20 54 68 65 79 20 67 | system.| They g|
|00003d10| 65 6e 65 72 61 6c 6c 79 | 20 61 70 70 65 61 72 20 |enerally| appear |
|00003d20| 61 73 20 6c 6f 73 73 20 | 6f 66 20 66 75 6e 63 74 |as loss |of funct|
|00003d30| 69 6f 6e 61 6c 69 74 79 | 20 28 6e 6f 74 20 62 65 |ionality| (not be|
|00003d40| 69 6e 67 20 61 62 6c 65 | 20 74 6f 20 6d 6f 76 65 |ing able| to move|
|00003d50| 20 61 20 77 69 6e 64 6f | 77 20 74 6f 20 74 68 65 | a windo|w to the|
|00003d60| 20 62 6f 74 74 6f 6d 20 | 6f 66 20 74 68 65 20 73 | bottom |of the s|
|00003d70| 63 72 65 65 6e 29 2c 20 | 6f 72 20 61 73 20 64 72 |creen), |or as dr|
|00003d80| 61 77 69 6e 67 20 72 6f | 75 74 69 6e 65 73 20 74 |awing ro|utines t|
|00003d90| 68 61 74 20 6e 6f 20 6c | 6f 6e 67 65 72 20 6c 6f |hat no l|onger lo|
|00003da0| 6f 6b 20 63 6f 72 72 65 | 63 74 2e 20 20 54 68 65 |ok corre|ct. The|
|00003db0| 73 65 20 70 72 6f 62 6c | 65 6d 73 20 63 61 6e 20 |se probl|ems can |
|00003dc0| 70 72 65 76 65 6e 74 20 | 61 6e 20 6f 74 68 65 72 |prevent |an other|
|00003dd0| 77 69 73 65 20 77 6f 6e | 64 65 72 66 75 6c 20 70 |wise won|derful p|
|00003de0| 72 6f 67 72 61 6d 20 66 | 72 6f 6d 20 62 65 69 6e |rogram f|rom bein|
|00003df0| 67 20 75 73 65 64 2e 0d | 48 6f 77 20 74 6f 20 61 |g used..|How to a|
|00003e00| 76 6f 69 64 20 62 65 69 | 6e 67 20 61 20 72 6f 77 |void bei|ng a row|
|00003e10| 20 62 79 74 65 72 0d 49 | 6e 20 61 6e 79 20 63 61 | byter.I|n any ca|
|00003e20| 6c 63 75 6c 61 74 69 6f | 6e 73 2c 20 74 68 65 20 |lculatio|ns, the |
|00003e30| 72 6f 77 42 79 74 65 73 | 20 76 61 72 69 61 62 6c |rowBytes| variabl|
|00003e40| 65 20 73 68 6f 75 6c 64 | 20 62 65 20 74 68 6f 75 |e should| be thou|
|00003e50| 67 68 74 20 6f 66 20 61 | 73 20 74 68 65 20 77 61 |ght of a|s the wa|
|00003e60| 79 20 74 6f 20 67 65 74 | 20 74 6f 20 74 68 65 20 |y to get| to the |
|00003e70| 6e 65 78 74 20 72 6f 77 | 20 6f 6e 20 74 68 65 20 |next row| on the |
|00003e80| 73 63 72 65 65 6e 2e 20 | 20 54 68 69 73 20 69 73 |screen. | This is|
|00003e90| 20 64 69 73 74 69 6e 63 | 74 20 66 72 6f 6d 20 74 | distinc|t from t|
|00003ea0| 68 69 6e 6b 69 6e 67 20 | 6f 66 20 69 74 20 61 73 |hinking |of it as|
|00003eb0| 20 74 68 65 20 77 69 64 | 74 68 20 6f 66 20 74 68 | the wid|th of th|
|00003ec0| 65 20 73 63 72 65 65 6e | 2e 20 20 54 68 65 20 77 |e screen|. The w|
|00003ed0| 69 64 74 68 20 73 68 6f | 75 6c 64 20 61 6c 77 61 |idth sho|uld alwa|
|00003ee0| 79 73 20 62 65 20 66 6f | 75 6e 64 20 66 72 6f 6d |ys be fo|und from|
|00003ef0| 20 73 63 72 65 65 6e 42 | 69 74 73 2e 62 6f 75 6e | screenB|its.boun|
|00003f00| 64 73 2e 72 69 67 68 74 | d0 20 73 63 72 65 65 6e |ds.right|. screen|
|00003f10| 42 69 74 73 2e 62 6f 75 | 6e 64 73 2e 6c 65 66 74 |Bits.bou|nds.left|
|00003f20| 2e 20 20 20 0d 49 74 20 | 69 73 20 61 6c 73 6f 20 |. .It |is also |
|00003f30| 69 6e 61 70 70 72 6f 70 | 72 69 61 74 65 20 74 6f |inapprop|riate to|
|00003f40| 20 75 73 65 20 74 68 65 | 20 72 65 63 74 61 6e 67 | use the| rectang|
|00003f50| 6c 65 20 74 6f 20 64 65 | 63 69 64 65 20 68 6f 77 |le to de|cide how|
|00003f60| 20 6d 61 6e 79 20 62 79 | 74 65 73 20 74 68 65 72 | many by|tes ther|
|00003f70| 65 20 61 72 65 20 6f 6e | 20 61 20 72 6f 77 2e 20 |e are on| a row. |
|00003f80| 20 50 72 6f 67 72 61 6d | 73 20 74 68 61 74 20 64 | Program|s that d|
|00003f90| 6f 20 73 6f 6d 65 74 68 | 69 6e 67 20 6c 69 6b 65 |o someth|ing like|
|00003fa0| 3a 0d 09 62 79 74 65 73 | 4c 69 6e 65 20 3a 3d 20 |:..bytes|Line := |
|00003fb0| 73 63 72 65 65 6e 42 69 | 74 73 2e 62 6f 75 6e 64 |screenBi|ts.bound|
|00003fc0| 73 2e 72 69 67 68 74 20 | 44 49 56 20 38 3b 20 20 |s.right |DIV 8; |
|00003fd0| 7b 20 62 61 64 20 75 73 | 65 20 6f 66 20 62 6f 75 |{ bad us|e of bou|
|00003fe0| 6e 64 73 20 7d 0d 09 72 | 69 67 68 74 53 69 64 65 |nds }..r|ightSide|
|00003ff0| 20 3a 3d 20 73 63 72 65 | 65 6e 42 69 74 73 2e 72 | := scre|enBits.r|
|00004000| 6f 77 42 79 74 65 73 20 | 2a 20 38 3b 20 20 20 20 |owBytes |* 8; |
|00004010| 7b 20 62 61 64 20 75 73 | 65 20 6f 66 20 72 6f 77 |{ bad us|e of row|
|00004020| 42 79 74 65 73 20 7d 0d | 77 69 6c 6c 20 66 69 6e |Bytes }.|will fin|
|00004030| 64 20 74 68 61 74 20 74 | 68 65 20 73 63 72 65 65 |d that t|he scree|
|00004040| 6e 20 6d 61 79 20 68 61 | 76 65 20 6d 6f 72 65 20 |n may ha|ve more |
|00004050| 72 6f 77 42 79 74 65 73 | 20 74 68 61 6e 20 70 72 |rowBytes| than pr|
|00004060| 65 76 69 6f 75 73 6c 79 | 20 74 68 6f 75 67 68 74 |eviously| thought|
|00004070| 2e 20 20 54 68 65 20 62 | 65 73 74 20 77 61 79 20 |. The b|est way |
|00004080| 74 6f 20 61 76 6f 69 64 | 20 62 65 69 6e 67 20 61 |to avoid| being a|
|00004090| 20 72 6f 77 20 62 79 74 | 65 72 20 69 73 20 74 6f | row byt|er is to|
|000040a0| 20 75 73 65 20 74 68 65 | 20 70 72 6f 70 65 72 20 | use the| proper |
|000040b0| 76 61 72 69 61 62 6c 65 | 73 20 66 6f 72 20 74 68 |variable|s for th|
|000040c0| 65 20 70 72 6f 70 65 72 | 20 74 68 69 6e 67 73 2e |e proper| things.|
|000040d0| 20 20 57 69 74 68 6f 75 | 74 20 74 68 65 20 70 72 | Withou|t the pr|
|000040e0| 6f 70 65 72 20 6d 61 74 | 68 65 6d 61 74 69 63 61 |oper mat|hematica|
|000040f0| 6c 20 62 61 73 69 73 20 | 74 6f 20 74 68 65 20 73 |l basis |to the s|
|00004100| 63 72 65 65 6e 2c 20 6c | 69 66 65 20 62 65 63 6f |creen, l|ife beco|
|00004110| 6d 65 73 20 6d 75 63 68 | 20 6d 6f 72 65 20 64 69 |mes much| more di|
|00004120| 66 66 69 63 75 6c 74 2e | 20 20 41 6c 77 61 79 73 |fficult.| Always|
|00004130| 20 64 6f 20 74 68 69 6e | 67 73 20 6c 69 6b 65 3a | do thin|gs like:|
|00004140| 0d 09 62 79 74 65 73 4c | 69 6e 65 20 3a 3d 20 73 |..bytesL|ine := s|
|00004150| 63 72 65 65 6e 42 69 74 | 73 2e 72 6f 77 42 79 74 |creenBit|s.rowByt|
|00004160| 65 73 3b 20 20 7b 20 61 | 6c 77 61 79 73 20 74 68 |es; { a|lways th|
|00004170| 65 20 63 6f 72 72 65 63 | 74 20 6e 75 6d 62 65 72 |e correc|t number|
|00004180| 20 7d 0d 09 72 69 67 68 | 74 53 69 64 65 20 3a 3d | }..righ|tSide :=|
|00004190| 20 73 63 72 65 65 6e 42 | 69 74 73 2e 62 6f 75 6e | screenB|its.boun|
|000041a0| 64 73 2e 72 69 67 68 74 | 3b 20 20 7b 20 61 6c 77 |ds.right|; { alw|
|000041b0| 61 79 73 20 74 68 65 20 | 63 6f 72 72 65 63 74 20 |ays the |correct |
|000041c0| 73 63 72 65 65 6e 20 73 | 69 7a 65 20 7d 0d 49 74 |screen s|ize }.It|
|000041d0| 20 69 73 20 73 6f 6d 65 | 74 69 6d 65 73 20 6e 65 | is some|times ne|
|000041e0| 63 65 73 73 61 72 79 20 | 74 6f 20 64 6f 20 63 61 |cessary |to do ca|
|000041f0| 6c 63 75 6c 61 74 69 6f | 6e 73 20 69 6e 76 6f 6c |lculatio|ns invol|
|00004200| 76 69 6e 67 20 74 68 65 | 20 73 63 72 65 65 6e 2e |ving the| screen.|
|00004210| 20 20 49 66 20 73 6f 2c | 20 62 65 20 73 75 72 65 | If so,| be sure|
|00004220| 20 74 6f 20 75 73 65 20 | 4c 6f 6e 67 49 6e 74 73 | to use |LongInts|
|00004230| 20 66 6f 72 20 61 6c 6c | 20 74 68 65 20 6d 61 74 | for all| the mat|
|00004240| 68 2c 20 61 6e 64 20 62 | 65 20 73 75 72 65 20 74 |h, and b|e sure t|
|00004250| 6f 20 75 73 65 20 74 68 | 65 20 72 69 67 68 74 20 |o use th|e right |
|00004260| 76 61 72 69 61 62 6c 65 | 73 20 28 69 2e 65 2e 20 |variable|s (i.e. |
|00004270| 75 73 65 20 4c 6f 6e 67 | 49 6e 74 73 29 2e 20 20 |use Long|Ints). |
|00004280| 46 6f 72 20 65 78 61 6d | 70 6c 65 2c 20 69 66 20 |For exam|ple, if |
|00004290| 77 65 20 6e 65 65 64 20 | 74 6f 20 66 69 6e 64 20 |we need |to find |
|000042a0| 74 68 65 20 61 64 64 72 | 65 73 73 20 6f 66 20 74 |the addr|ess of t|
|000042b0| 68 65 20 35 30 30 74 68 | 20 72 6f 77 20 69 6e 20 |he 500th| row in |
|000042c0| 74 68 65 20 73 63 72 65 | 65 6e 20 28 35 30 30 20 |the scre|en (500 |
|000042d0| 6c 69 6e 65 73 20 66 72 | 6f 6d 20 74 68 65 20 74 |lines fr|om the t|
|000042e0| 6f 70 29 3a 0d 09 0d 56 | 41 52 09 6d 79 41 64 64 |op):...V|AR.myAdd|
|000042f0| 72 65 73 73 3a 09 4c 6f | 6e 67 49 6e 74 3b 0d 09 |ress:.Lo|ngInt;..|
|00004300| 6d 79 52 6f 77 3a 09 4c | 6f 6e 67 49 6e 74 3b 09 |myRow:.L|ongInt;.|
|00004310| 7b 20 73 6f 20 74 68 65 | 20 63 61 6c 63 75 6c 61 |{ so the| calcula|
|00004320| 74 69 6f 6e 73 20 64 6f | 6e d5 74 20 72 6f 75 6e |tions do|n.t roun|
|00004330| 64 20 6f 66 66 2e 20 7d | 0d 09 6d 79 4f 66 66 73 |d off. }|..myOffs|
|00004340| 65 74 3a 09 4c 6f 6e 67 | 49 6e 74 3b 09 7b 20 63 |et:.Long|Int;.{ c|
|00004350| 6f 75 6c 64 20 65 61 73 | 69 6c 79 20 62 65 20 6f |ould eas|ily be o|
|00004360| 76 65 72 20 33 32 37 36 | 38 20 2e 2e 2e 20 7d 0d |ver 3276|8 ... }.|
|00004370| 09 62 79 74 65 73 4c 69 | 6e 65 3a 09 4c 6f 6e 67 |.bytesLi|ne:.Long|
|00004380| 49 6e 74 3b 0d 09 2e 2e | 2e 0d 09 6d 79 41 64 64 |Int;....|...myAdd|
|00004390| 72 65 73 73 20 3a 3d 20 | 6f 72 64 34 28 73 63 72 |ress := |ord4(scr|
|000043a0| 65 65 6e 42 69 74 73 2e | 62 61 73 65 41 64 64 72 |eenBits.|baseAddr|
|000043b0| 29 3b 20 7b 73 74 61 72 | 74 20 77 2f 74 68 65 20 |); {star|t w/the |
|000043c0| 72 65 61 6c 20 62 61 73 | 65 20 61 64 64 72 65 73 |real bas|e addres|
|000043d0| 73 20 7d 0d 09 6d 79 52 | 6f 77 20 3a 3d 20 35 30 |s }..myR|ow := 50|
|000043e0| 30 3b 20 20 20 09 09 7b | 74 68 65 20 72 6f 77 20 |0; ..{|the row |
|000043f0| 77 65 20 77 61 6e 74 20 | 74 6f 20 61 64 64 72 65 |we want |to addre|
|00004400| 73 73 20 7d 0d 09 62 79 | 74 65 73 4c 69 6e 65 20 |ss }..by|tesLine |
|00004410| 3a 3d 20 73 63 72 65 65 | 6e 42 69 74 73 2e 72 6f |:= scree|nBits.ro|
|00004420| 77 42 79 74 65 73 3b 20 | 20 7b 74 68 65 20 72 65 |wBytes; | {the re|
|00004430| 61 6c 20 62 79 74 65 73 | 20 70 65 72 20 6c 69 6e |al bytes| per lin|
|00004440| 65 20 7d 0d 09 6d 79 4f | 66 66 73 65 74 20 3a 3d |e }..myO|ffset :=|
|00004450| 20 6d 79 52 6f 77 20 2a | 20 62 79 74 65 73 4c 69 | myRow *| bytesLi|
|00004460| 6e 65 3b 20 20 20 20 09 | 7b 6c 69 6e 65 73 20 2a |ne; .|{lines *|
|00004470| 20 62 79 74 65 73 20 70 | 65 72 20 6c 69 6e 65 73 | bytes p|er lines|
|00004480| 20 67 69 76 65 73 20 62 | 79 74 65 73 20 7d 0d 09 | gives b|ytes }..|
|00004490| 6d 79 41 64 64 72 65 73 | 73 20 3a 3d 20 6d 79 41 |myAddres|s := myA|
|000044a0| 64 64 72 65 73 73 20 2b | 20 6d 79 4f 66 66 73 65 |ddress +| myOffse|
|000044b0| 74 3b 09 7b 66 69 6e 61 | 6c 20 61 64 64 72 65 73 |t;.{fina|l addres|
|000044c0| 73 20 6f 66 20 74 68 65 | 20 35 30 30 74 68 20 6c |s of the| 500th l|
|000044d0| 69 6e 65 20 7d 0d 54 68 | 69 73 20 69 73 20 6e 6f |ine }.Th|is is no|
|000044e0| 74 20 73 6f 6d 65 74 68 | 69 6e 67 20 79 6f 75 20 |t someth|ing you |
|000044f0| 77 61 6e 74 20 74 6f 20 | 64 6f 20 69 66 20 79 6f |want to |do if yo|
|00004500| 75 20 63 61 6e 20 70 6f | 73 73 69 62 6c 79 20 61 |u can po|ssibly a|
|00004510| 76 6f 69 64 20 69 74 2c | 20 62 75 74 20 69 66 20 |void it,| but if |
|00004520| 79 6f 75 20 73 69 6d 70 | 6c 79 20 6d 75 73 74 20 |you simp|ly must |
|00004530| 67 6f 20 64 69 72 65 63 | 74 6c 79 20 74 6f 20 74 |go direc|tly to t|
|00004540| 68 65 20 73 63 72 65 65 | 6e 2c 20 62 65 20 63 61 |he scree|n, be ca|
|00004550| 72 65 66 75 6c 2e 20 20 | 54 68 65 20 62 69 67 2d |reful. |The big-|
|00004560| 73 63 72 65 65 6e 20 6d | 61 63 68 69 6e 65 73 20 |screen m|achines |
|00004570| 28 55 6c 74 72 61 2d 4c | 61 72 67 65 20 73 63 72 |(Ultra-L|arge scr|
|00004580| 65 65 6e 73 29 20 77 69 | 6c 6c 20 74 68 61 6e 6b |eens) wi|ll thank|
|00004590| 20 79 6f 75 20 66 6f 72 | 20 69 74 2e 20 20 49 66 | you for| it. If|
|000045a0| 20 51 75 69 63 6b 44 72 | 61 77 20 63 61 6e 6e 6f | QuickDr|aw canno|
|000045b0| 74 20 62 65 20 69 6e 69 | 74 69 61 6c 69 7a 65 64 |t be ini|tialized|
|000045c0| 2c 20 74 68 65 72 65 20 | 69 73 20 61 6c 73 6f 20 |, there |is also |
|000045d0| 74 68 65 20 6c 6f 77 2d | 6d 65 6d 6f 72 79 20 67 |the low-|memory g|
|000045e0| 6c 6f 62 61 6c 20 73 63 | 72 65 65 6e 52 6f 77 20 |lobal sc|reenRow |
|000045f0| 28 61 20 77 6f 72 64 20 | 61 74 20 24 31 30 36 29 |(a word |at $106)|
|00004600| 20 74 68 61 74 20 77 69 | 6c 6c 20 67 69 76 65 20 | that wi|ll give |
|00004610| 79 6f 75 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 |you the |current |
|00004620| 72 6f 77 42 79 74 65 73 | 2e 20 20 0d 48 6f 77 20 |rowBytes|. .How |
|00004630| 74 6f 20 66 69 6e 64 20 | 72 6f 77 20 62 79 74 65 |to find |row byte|
|00004640| 72 73 0d 54 6f 20 66 69 | 6e 64 20 63 75 72 72 65 |rs.To fi|nd curre|
|00004650| 6e 74 20 70 72 6f 62 6c | 65 6d 73 20 77 69 74 68 |nt probl|ems with|
|00004660| 20 72 6f 77 20 62 79 74 | 65 72 20 70 72 6f 67 72 | row byt|er progr|
|00004670| 61 6d 73 2c 20 72 75 6e | 20 74 68 65 6d 20 6f 6e |ams, run| them on|
|00004680| 20 61 20 6d 61 63 68 69 | 6e 65 20 65 71 75 69 70 | a machi|ne equip|
|00004690| 70 65 64 20 77 69 74 68 | 20 55 6c 74 72 61 2d 4c |ped with| Ultra-L|
|000046a0| 61 72 67 65 20 73 63 72 | 65 65 6e 73 20 61 6e 64 |arge scr|eens and|
|000046b0| 20 73 65 65 20 69 66 20 | 61 6e 79 20 61 6e 6f 6d | see if |any anom|
|000046c0| 61 6c 69 65 73 20 63 72 | 6f 70 20 75 70 2e 20 20 |alies cr|op up. |
|000046d0| 4c 6f 6f 6b 20 66 6f 72 | 20 64 72 61 77 69 6e 67 |Look for| drawing|
|000046e0| 20 73 65 71 75 65 6e 63 | 65 73 20 74 68 61 74 20 | sequenc|es that |
|000046f0| 64 6f 6e d5 74 20 77 6f | 72 6b 20 72 69 67 68 74 |don.t wo|rk right|
|00004700| 2c 20 61 6e 64 20 66 6f | 72 20 64 72 61 77 69 6e |, and fo|r drawin|
|00004710| 67 20 74 68 61 74 20 63 | 6c 69 70 73 20 74 6f 20 |g that c|lips to |
|00004720| 61 6e 20 69 6d 61 67 69 | 6e 61 72 79 20 65 64 67 |an imagi|nary edg|
|00004730| 65 2e 20 20 46 6f 72 20 | 73 6f 75 72 63 65 2d 6c |e. For |source-l|
|00004740| 65 76 65 6c 20 69 6e 73 | 70 65 63 74 69 6f 6e 2c |evel ins|pection,|
|00004750| 20 6c 6f 6f 6b 20 66 6f | 72 20 75 73 65 73 20 6f | look fo|r uses o|
|00004760| 66 20 74 68 65 20 72 6f | 77 42 79 74 65 73 20 76 |f the ro|wBytes v|
|00004770| 61 72 69 61 62 6c 65 73 | 20 61 6e 64 20 62 65 20 |ariables| and be |
|00004780| 73 75 72 65 20 74 68 61 | 74 20 74 68 65 79 20 61 |sure tha|t they a|
|00004790| 72 65 20 62 65 69 6e 67 | 20 75 73 65 64 20 69 6e |re being| used in|
|000047a0| 20 61 20 6d 61 74 68 65 | 6d 61 74 69 63 61 6c 6c | a mathe|maticall|
|000047b0| 79 20 73 6f 75 6e 64 20 | 66 61 73 68 69 6f 6e 2e |y sound |fashion.|
|000047c0| 20 20 42 65 20 68 69 67 | 68 6c 79 20 73 75 73 70 | Be hig|hly susp|
|000047d0| 69 63 69 6f 75 73 20 6f | 66 20 61 6e 79 20 63 6f |icious o|f any co|
|000047e0| 64 65 20 74 68 61 74 20 | 75 73 65 73 20 72 6f 77 |de that |uses row|
|000047f0| 42 79 74 65 73 20 66 6f | 72 20 74 68 65 20 73 63 |Bytes fo|r the sc|
|00004800| 72 65 65 6e 20 77 69 64 | 74 68 2e 20 20 41 6e 79 |reen wid|th. Any|
|00004810| 20 63 61 6c 63 75 6c 61 | 74 69 6f 6e 73 20 69 6e | calcula|tions in|
|00004820| 76 6f 6c 76 69 6e 67 20 | 74 68 6f 73 65 20 73 79 |volving |those sy|
|00004830| 73 74 65 6d 20 76 61 72 | 69 61 62 6c 65 73 20 73 |stem var|iables s|
|00004840| 68 6f 75 6c 64 20 62 65 | 20 63 6c 6f 73 65 6c 79 |hould be| closely|
|00004850| 20 69 6e 73 70 65 63 74 | 65 64 20 66 6f 72 20 72 | inspect|ed for r|
|00004860| 6f 75 6e 64 2d 6f 66 66 | 20 65 72 72 6f 72 73 20 |ound-off| errors |
|00004870| 61 6e 64 20 69 6d 70 72 | 6f 70 65 72 20 75 73 65 |and impr|oper use|
|00004880| 2e 20 20 53 65 61 72 63 | 68 20 66 6f 72 20 74 68 |. Searc|h for th|
|00004890| 65 20 6e 75 6d 62 65 72 | 20 38 2e 20 20 49 66 20 |e number| 8. If |
|000048a0| 69 74 20 69 73 20 62 65 | 69 6e 67 20 75 73 65 64 |it is be|ing used|
|000048b0| 20 69 6e 20 61 20 63 61 | 6c 63 75 6c 61 74 69 6f | in a ca|lculatio|
|000048c0| 6e 20 77 68 65 72 65 20 | 69 74 20 69 73 20 74 68 |n where |it is th|
|000048d0| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 62 69 74 73 |e number| of bits|
|000048e0| 20 70 65 72 20 62 79 74 | 65 2c 20 74 68 65 6e 20 | per byt|e, then |
|000048f0| 77 61 74 63 68 20 74 68 | 61 74 20 63 6f 64 65 20 |watch th|at code |
|00004900| 63 6c 6f 73 65 6c 79 20 | 66 6f 72 20 69 6d 70 72 |closely |for impr|
|00004910| 6f 70 65 72 20 63 6f 6e | 63 65 70 74 75 61 6c 69 |oper con|ceptuali|
|00004920| 7a 61 74 69 6f 6e 2e 20 | 20 54 68 69 73 20 69 73 |zation. | This is|
|00004930| 20 63 6f 64 65 20 74 68 | 61 74 20 63 6f 75 6c 64 | code th|at could|
|00004940| 20 6c 65 61 70 20 6f 75 | 74 20 61 6e 64 20 67 72 | leap ou|t and gr|
|00004950| 61 62 20 79 6f 75 20 62 | 79 20 74 68 65 20 74 68 |ab you b|y the th|
|00004960| 72 6f 61 74 20 61 74 20 | 61 6e 79 74 69 6d 65 2e |roat at |anytime.|
|00004970| 20 20 42 65 20 63 61 72 | 65 66 75 6c 21 0d 55 73 | Be car|eful!.Us|
|00004980| 69 6e 67 20 6e 69 6c 20 | 48 61 6e 64 6c 65 73 20 |ing nil |Handles |
|00004990| 6f 72 20 6e 69 6c 20 50 | 6f 69 6e 74 65 72 73 0d |or nil P|ointers.|
|000049a0| 41 20 6e 69 6c 20 70 6f | 69 6e 74 65 72 20 69 73 |A nil po|inter is|
|000049b0| 20 61 20 70 6f 69 6e 74 | 65 72 20 74 68 61 74 20 | a point|er that |
|000049c0| 68 61 73 20 61 20 76 61 | 6c 75 65 20 6f 66 20 30 |has a va|lue of 0|
|000049d0| 2e 20 20 52 65 63 6f 67 | 6e 69 7a 65 20 74 68 61 |. Recog|nize tha|
|000049e0| 74 20 70 6f 69 6e 74 65 | 72 73 20 61 72 65 20 6d |t pointe|rs are m|
|000049f0| 65 72 65 6c 79 20 61 64 | 64 72 65 73 73 65 73 20 |erely ad|dresses |
|00004a00| 69 6e 20 6d 65 6d 6f 72 | 79 2e 20 20 54 68 69 73 |in memor|y. This|
|00004a10| 20 6d 65 61 6e 73 20 74 | 68 61 74 20 61 20 6e 69 | means t|hat a ni|
|00004a20| 6c 20 70 6f 69 6e 74 65 | 72 20 69 73 20 70 6f 69 |l pointe|r is poi|
|00004a30| 6e 74 69 6e 67 20 74 6f | 20 6d 65 6d 6f 72 79 20 |nting to| memory |
|00004a40| 6c 6f 63 61 74 69 6f 6e | 20 30 2e 20 20 41 6e 79 |location| 0. Any|
|00004a50| 20 75 73 65 20 6f 66 20 | 6d 65 6d 6f 72 79 20 6c | use of |memory l|
|00004a60| 6f 63 61 74 69 6f 6e 20 | 30 20 69 73 20 73 74 72 |ocation |0 is str|
|00004a70| 69 63 74 6c 79 20 66 6f | 72 62 69 64 64 65 6e 2c |ictly fo|rbidden,|
|00004a80| 20 73 69 6e 63 65 20 69 | 74 20 69 73 20 6f 77 6e | since i|t is own|
|00004a90| 65 64 20 62 79 20 4d 6f | 74 6f 72 6f 6c 61 2e 20 |ed by Mo|torola. |
|00004aa0| 20 54 72 65 73 70 61 73 | 73 65 72 73 20 6d 61 79 | Trespas|sers may|
|00004ab0| 20 62 65 20 73 68 6f 74 | 20 6f 6e 20 73 69 67 68 | be shot| on sigh|
|00004ac0| 74 2c 20 62 75 74 20 74 | 68 65 79 20 6d 61 79 20 |t, but t|hey may |
|00004ad0| 6e 6f 74 20 64 69 65 20 | 75 6e 74 69 6c 20 6d 75 |not die |until mu|
|00004ae0| 63 68 20 6c 61 74 65 72 | 2e 20 20 53 6f 6d 65 74 |ch later|. Somet|
|00004af0| 69 6d 65 73 20 74 72 65 | 73 70 61 73 73 65 72 73 |imes tre|spassers|
|00004b00| 20 61 72 65 20 6f 6e 6c | 79 20 77 6f 75 6e 64 65 | are onl|y wounde|
|00004b10| 64 20 61 6e 64 20 61 63 | 74 20 73 74 72 61 6e 67 |d and ac|t strang|
|00004b20| 65 6c 79 2e 20 20 41 6e | 79 20 75 73 65 20 6f 66 |ely. An|y use of|
|00004b30| 20 6d 65 6d 6f 72 79 20 | 6c 6f 63 61 74 69 6f 6e | memory |location|
|00004b40| 20 30 20 63 61 6e 20 62 | 65 20 63 6f 6e 73 69 64 | 0 can b|e consid|
|00004b50| 65 72 65 64 20 61 20 62 | 75 67 2c 20 73 69 6e 63 |ered a b|ug, sinc|
|00004b60| 65 20 74 68 65 72 65 20 | 61 72 65 20 6e 6f 20 76 |e there |are no v|
|00004b70| 61 6c 69 64 20 72 65 61 | 73 6f 6e 73 20 66 6f 72 |alid rea|sons for|
|00004b80| 20 4d 61 63 69 6e 74 6f | 73 68 20 70 72 6f 67 72 | Macinto|sh progr|
|00004b90| 61 6d 73 20 74 6f 20 72 | 65 61 64 20 6f 72 20 77 |ams to r|ead or w|
|00004ba0| 72 69 74 65 20 74 6f 20 | 74 68 61 74 20 6d 65 6d |rite to |that mem|
|00004bb0| 6f 72 79 2e 20 20 48 6f | 77 65 76 65 72 2c 20 6e |ory. Ho|wever, n|
|00004bc0| 69 6c 20 70 6f 69 6e 74 | 65 72 73 20 74 68 65 6d |il point|ers them|
|00004bd0| 73 65 6c 76 65 73 20 61 | 72 65 20 6e 6f 74 20 6e |selves a|re not n|
|00004be0| 65 63 65 73 73 61 72 69 | 6c 79 20 62 61 64 2e 20 |ecessari|ly bad. |
|00004bf0| 20 49 74 20 69 73 20 6f | 63 63 61 73 69 6f 6e 61 | It is o|ccasiona|
|00004c00| 6c 6c 79 20 6e 65 63 65 | 73 73 61 72 79 20 74 6f |lly nece|ssary to|
|00004c10| 20 70 61 73 73 20 6e 69 | 6c 20 70 6f 69 6e 74 65 | pass ni|l pointe|
|00004c20| 72 73 20 74 6f 20 52 4f | 4d 20 72 6f 75 74 69 6e |rs to RO|M routin|
|00004c30| 65 73 2e 20 20 54 68 69 | 73 20 73 68 6f 75 6c 64 |es. Thi|s should|
|00004c40| 20 6e 6f 74 20 62 65 20 | 63 6f 6e 66 75 73 65 64 | not be |confused|
|00004c50| 20 77 69 74 68 20 72 65 | 61 64 69 6e 67 20 6f 72 | with re|ading or|
|00004c60| 20 77 72 69 74 69 6e 67 | 20 74 6f 20 6d 65 6d 6f | writing| to memo|
|00004c70| 72 79 20 6c 6f 63 61 74 | 69 6f 6e 20 30 2e 20 20 |ry locat|ion 0. |
|00004c80| 41 20 70 6f 69 6e 74 65 | 72 20 6e 6f 72 6d 61 6c |A pointe|r normal|
|00004c90| 6c 79 20 70 6f 69 6e 74 | 73 20 74 6f 20 28 63 6f |ly point|s to (co|
|00004ca0| 6e 74 61 69 6e 73 20 74 | 68 65 20 61 64 64 72 65 |ntains t|he addre|
|00004cb0| 73 73 20 6f 66 29 20 61 | 20 6c 6f 63 61 74 69 6f |ss of) a| locatio|
|00004cc0| 6e 20 69 6e 20 6d 65 6d | 6f 72 79 2e 20 20 49 74 |n in mem|ory. It|
|00004cd0| 20 63 6f 75 6c 64 20 6c | 6f 6f 6b 20 6c 69 6b 65 | could l|ook like|
|00004ce0| 20 74 68 69 73 3a 0d 49 | 66 20 61 20 70 6f 69 6e | this:.I|f a poin|
|00004cf0| 74 65 72 20 68 61 73 20 | 62 65 65 6e 20 63 6c 65 |ter has |been cle|
|00004d00| 61 72 65 64 20 74 6f 20 | 6e 69 6c 2c 20 69 74 20 |ared to |nil, it |
|00004d10| 77 69 6c 6c 20 70 6f 69 | 6e 74 20 74 6f 20 6d 65 |will poi|nt to me|
|00004d20| 6d 6f 72 79 20 6c 6f 63 | 61 74 69 6f 6e 20 30 2e |mory loc|ation 0.|
|00004d30| 20 20 54 68 69 73 20 69 | 73 20 4f 4b 20 61 73 20 | This i|s OK as |
|00004d40| 6c 6f 6e 67 20 61 73 20 | 74 68 65 20 70 72 6f 67 |long as |the prog|
|00004d50| 72 61 6d 20 64 6f 65 73 | 20 6e 6f 74 20 74 72 79 |ram does| not try|
|00004d60| 20 74 6f 20 72 65 61 64 | 20 66 72 6f 6d 20 6f 72 | to read| from or|
|00004d70| 20 77 72 69 74 65 20 74 | 6f 20 74 68 61 74 20 70 | write t|o that p|
|00004d80| 6f 69 6e 74 65 72 2e 20 | 20 41 6e 20 65 78 61 6d |ointer. | An exam|
|00004d90| 70 6c 65 20 6f 66 20 61 | 20 6e 69 6c 20 70 6f 69 |ple of a| nil poi|
|00004da0| 6e 74 65 72 20 63 6f 75 | 6c 64 20 6c 6f 6f 6b 20 |nter cou|ld look |
|00004db0| 6c 69 6b 65 3a 0d 6e 69 | 6c 20 68 61 6e 64 6c 65 |like:.ni|l handle|
|00004dc0| 73 20 61 72 65 20 72 65 | 6c 61 74 65 64 20 74 6f |s are re|lated to|
|00004dd0| 20 74 68 65 20 70 72 6f | 62 6c 65 6d 2c 20 73 69 | the pro|blem, si|
|00004de0| 6e 63 65 20 61 20 68 61 | 6e 64 6c 65 20 69 73 20 |nce a ha|ndle is |
|00004df0| 6d 65 72 65 6c 79 20 74 | 68 65 20 61 64 64 72 65 |merely t|he addre|
|00004e00| 73 73 20 6f 66 20 61 20 | 70 6f 69 6e 74 65 72 20 |ss of a |pointer |
|00004e10| 28 6f 72 20 61 20 70 6f | 69 6e 74 65 72 20 74 6f |(or a po|inter to|
|00004e20| 20 61 20 70 6f 69 6e 74 | 65 72 29 2e 20 20 41 6e | a point|er). An|
|00004e30| 20 65 78 61 6d 70 6c 65 | 20 6f 66 20 77 68 61 74 | example| of what|
|00004e40| 20 61 20 6e 6f 72 6d 61 | 6c 20 68 61 6e 64 6c 65 | a norma|l handle|
|00004e50| 20 6d 69 67 68 74 20 6c | 6f 6f 6b 20 6c 69 6b 65 | might l|ook like|
|00004e60| 20 69 73 3a 0d 57 68 65 | 6e 20 74 68 65 20 66 69 | is:.Whe|n the fi|
|00004e70| 72 73 74 20 70 6f 69 6e | 74 65 72 20 28 68 29 20 |rst poin|ter (h) |
|00004e80| 62 65 63 6f 6d 65 73 20 | 6e 69 6c 2c 20 74 68 61 |becomes |nil, tha|
|00004e90| 74 20 69 6d 70 6c 69 65 | 73 20 74 68 61 74 20 6d |t implie|s that m|
|00004ea0| 65 6d 6f 72 79 20 6c 6f | 63 61 74 69 6f 6e 20 30 |emory lo|cation 0|
|00004eb0| 20 63 61 6e 20 62 65 20 | 75 73 65 64 20 61 73 20 | can be |used as |
|00004ec0| 61 20 70 6f 69 6e 74 65 | 72 2e 20 20 54 68 69 73 |a pointe|r. This|
|00004ed0| 20 69 73 20 73 74 72 69 | 63 74 6c 79 20 69 6c 6c | is stri|ctly ill|
|00004ee0| 65 67 61 6c 2e 20 20 54 | 68 65 72 65 20 61 72 65 |egal. T|here are|
|00004ef0| 20 6e 6f 20 63 61 73 65 | 73 20 77 68 65 72 65 20 | no case|s where |
|00004f00| 69 74 20 69 73 20 76 61 | 6c 69 64 20 74 6f 20 72 |it is va|lid to r|
|00004f10| 65 61 64 20 66 72 6f 6d | 20 6f 72 20 77 72 69 74 |ead from| or writ|
|00004f20| 65 20 74 6f 20 61 20 6e | 69 6c 20 68 61 6e 64 6c |e to a n|il handl|
|00004f30| 65 2e 20 20 20 41 20 70 | 69 63 74 6f 72 69 61 6c |e. A p|ictorial|
|00004f40| 20 72 65 70 72 65 73 65 | 6e 74 61 74 69 6f 6e 20 | represe|ntation |
|00004f50| 6f 66 20 77 68 61 74 20 | 61 20 6e 69 6c 20 68 61 |of what |a nil ha|
|00004f60| 6e 64 6c 65 20 63 6f 75 | 6c 64 20 6c 6f 6f 6b 20 |ndle cou|ld look |
|00004f70| 6c 69 6b 65 3a 0d 49 66 | 20 74 68 65 20 6d 65 6d |like:.If| the mem|
|00004f80| 6f 72 79 20 61 74 20 30 | 20 63 6f 6e 74 61 69 6e |ory at 0| contain|
|00004f90| 73 20 61 6e 20 6f 64 64 | 20 6e 75 6d 62 65 72 20 |s an odd| number |
|00004fa0| 28 6e 75 6d 65 72 69 63 | 61 6c 6c 79 20 6f 64 64 |(numeric|ally odd|
|00004fb0| 29 2c 20 74 68 65 6e 20 | 75 73 69 6e 67 20 69 74 |), then |using it|
|00004fc0| 20 61 73 20 61 20 70 6f | 69 6e 74 65 72 20 77 69 | as a po|inter wi|
|00004fd0| 6c 6c 20 63 61 75 73 65 | 20 61 20 73 79 73 74 65 |ll cause| a syste|
|00004fe0| 6d 20 65 72 72 6f 72 20 | 77 69 74 68 20 49 44 3d |m error |with ID=|
|00004ff0| 32 2e 20 20 54 68 69 73 | 20 63 61 6e 20 62 65 20 |2. This| can be |
|00005000| 76 65 72 79 20 75 73 65 | 66 75 6c 2c 20 73 69 6e |very use|ful, sin|
|00005010| 63 65 20 74 68 61 74 20 | 74 65 6c 6c 73 20 79 6f |ce that |tells yo|
|00005020| 75 20 65 78 61 63 74 6c | 79 20 77 68 65 72 65 20 |u exactl|y where |
|00005030| 74 68 65 20 70 72 6f 67 | 72 61 6d 20 69 73 20 75 |the prog|ram is u|
|00005040| 73 69 6e 67 20 74 68 69 | 73 20 69 6c 6c 65 67 61 |sing thi|s illega|
|00005050| 6c 20 68 61 6e 64 6c 65 | 2c 20 6d 61 6b 69 6e 67 |l handle|, making|
|00005060| 20 69 74 20 65 61 73 79 | 20 74 6f 20 66 69 78 2e | it easy| to fix.|
|00005070| 20 20 55 6e 66 6f 72 74 | 75 6e 61 74 65 6c 79 2c | Unfort|unately,|
|00005080| 20 74 68 65 72 65 20 61 | 72 65 20 63 61 73 65 73 | there a|re cases|
|00005090| 20 77 68 65 72 65 20 69 | 74 20 69 73 20 61 70 70 | where i|t is app|
|000050a0| 72 6f 70 72 69 61 74 65 | 20 74 6f 20 70 61 73 73 |ropriate| to pass|
|000050b0| 20 61 20 6e 69 6c 20 68 | 61 6e 64 6c 65 20 74 6f | a nil h|andle to|
|000050c0| 20 52 4f 4d 20 72 6f 75 | 74 69 6e 65 73 20 28 73 | ROM rou|tines (s|
|000050d0| 75 63 68 20 61 73 20 47 | 65 74 53 63 72 61 70 29 |uch as G|etScrap)|
|000050e0| 2e 20 20 54 68 65 73 65 | 20 63 61 73 65 73 20 61 |. These| cases a|
|000050f0| 72 65 20 72 61 72 65 2c | 20 61 6e 64 20 69 74 20 |re rare,| and it |
|00005100| 69 73 20 6e 65 76 65 72 | 20 6c 65 67 61 6c 20 74 |is never| legal t|
|00005110| 6f 20 72 65 61 64 20 66 | 72 6f 6d 20 6f 72 20 77 |o read f|rom or w|
|00005120| 72 69 74 65 20 74 6f 20 | 61 20 6e 69 6c 20 68 61 |rite to |a nil ha|
|00005130| 6e 64 6c 65 2e 0d 54 68 | 65 72 65 20 69 73 20 61 |ndle..Th|ere is a|
|00005140| 6c 73 6f 20 74 68 65 20 | 63 61 73 65 20 6f 66 20 |lso the |case of |
|00005150| 61 6e 20 65 6d 70 74 79 | 20 68 61 6e 64 6c 65 2e |an empty| handle.|
|00005160| 20 20 41 6e 20 65 6d 70 | 74 79 20 68 61 6e 64 6c | An emp|ty handl|
|00005170| 65 20 69 73 20 6f 6e 65 | 20 77 68 65 72 65 20 74 |e is one| where t|
|00005180| 68 65 20 68 61 6e 64 6c | 65 20 69 74 73 65 6c 66 |he handl|e itself|
|00005190| 20 28 74 68 65 20 66 69 | 72 73 74 20 70 6f 69 6e | (the fi|rst poin|
|000051a0| 74 65 72 29 20 70 6f 69 | 6e 74 73 20 74 6f 20 61 |ter) poi|nts to a|
|000051b0| 20 76 61 6c 69 64 20 70 | 6c 61 63 65 20 69 6e 20 | valid p|lace in |
|000051c0| 6d 65 6d 6f 72 79 3b 20 | 74 68 61 74 20 70 6c 61 |memory; |that pla|
|000051d0| 63 65 20 69 6e 20 6d 65 | 6d 6f 72 79 20 69 73 20 |ce in me|mory is |
|000051e0| 61 6c 73 6f 20 61 20 70 | 6f 69 6e 74 65 72 2c 20 |also a p|ointer, |
|000051f0| 61 6e 64 20 69 66 20 69 | 74 20 69 73 20 6e 69 6c |and if i|t is nil|
|00005200| 20 74 68 65 20 65 6e 74 | 69 72 65 20 68 61 6e 64 | the ent|ire hand|
|00005210| 6c 65 20 69 73 20 74 65 | 72 6d 65 64 20 65 6d 70 |le is te|rmed emp|
|00005220| 74 79 2e 20 54 68 65 72 | 65 20 61 72 65 20 6f 63 |ty. Ther|e are oc|
|00005230| 63 61 73 69 6f 6e 73 20 | 77 68 65 72 65 20 69 74 |casions |where it|
|00005240| 20 69 73 20 6e 65 63 65 | 73 73 61 72 79 20 74 6f | is nece|ssary to|
|00005250| 20 75 73 65 20 74 68 65 | 20 68 61 6e 64 6c 65 20 | use the| handle |
|00005260| 69 74 73 65 6c 66 2c 20 | 62 75 74 20 75 73 69 6e |itself, |but usin|
|00005270| 67 20 74 68 65 20 6e 69 | 6c 20 70 6f 69 6e 74 65 |g the ni|l pointe|
|00005280| 72 20 74 68 61 74 20 69 | 74 20 63 6f 6e 74 61 69 |r that i|t contai|
|00005290| 6e 73 20 69 73 20 6e 6f | 74 20 76 61 6c 69 64 2e |ns is no|t valid.|
|000052a0| 20 20 41 6e 20 65 78 61 | 6d 70 6c 65 20 6f 66 20 | An exa|mple of |
|000052b0| 61 6e 20 65 6d 70 74 79 | 20 68 61 6e 64 6c 65 20 |an empty| handle |
|000052c0| 63 6f 75 6c 64 20 62 65 | 3a 0d 46 75 6e 64 61 6d |could be|:.Fundam|
|000052d0| 65 6e 74 61 6c 6c 79 2c | 20 61 6e 79 20 72 65 61 |entally,| any rea|
|000052e0| 64 69 6e 67 20 6f 72 20 | 77 72 69 74 69 6e 67 20 |ding or |writing |
|000052f0| 74 6f 20 6d 65 6d 6f 72 | 79 20 75 73 69 6e 67 20 |to memor|y using |
|00005300| 61 20 70 6f 69 6e 74 65 | 72 20 6f 72 20 68 61 6e |a pointe|r or han|
|00005310| 64 6c 65 20 74 68 61 74 | 20 69 73 20 6e 69 6c 20 |dle that| is nil |
|00005320| 69 73 20 70 75 6e 69 73 | 68 61 62 6c 65 20 62 79 |is punis|hable by|
|00005330| 20 64 65 61 74 68 20 28 | 6f 66 20 79 6f 75 72 20 | death (|of your |
|00005340| 70 72 6f 67 72 61 6d 29 | 2e 20 0d 57 68 79 20 69 |program)|. .Why i|
|00005350| 74 d5 73 20 42 61 64 0d | 54 68 65 20 75 73 65 20 |t.s Bad.|The use |
|00005360| 6f 66 20 6e 69 6c 20 70 | 6f 69 6e 74 65 72 73 20 |of nil p|ointers |
|00005370| 63 61 6e 20 6c 65 61 64 | 20 74 6f 20 74 68 65 20 |can lead| to the |
|00005380| 75 73 65 20 6f 66 20 6d | 61 6b 65 2d 62 65 6c 69 |use of m|ake-beli|
|00005390| 65 76 65 20 64 61 74 61 | 2e 20 20 54 68 69 73 20 |eve data|. This |
|000053a0| 6d 61 6b 65 2d 62 65 6c | 69 65 76 65 20 64 61 74 |make-bel|ieve dat|
|000053b0| 61 20 6f 66 74 65 6e 20 | 63 68 61 6e 67 65 73 20 |a often |changes |
|000053c0| 66 6f 72 20 64 69 66 66 | 65 72 65 6e 74 20 76 65 |for diff|erent ve|
|000053d0| 72 73 69 6f 6e 73 20 6f | 66 20 74 68 65 20 63 6f |rsions o|f the co|
|000053e0| 6d 70 75 74 65 72 2e 20 | 20 54 68 69 73 20 63 68 |mputer. | This ch|
|000053f0| 61 6e 67 69 6e 67 20 64 | 61 74 61 20 6d 61 6b 65 |anging d|ata make|
|00005400| 73 20 69 74 20 64 69 66 | 66 69 63 75 6c 74 20 74 |s it dif|ficult t|
|00005410| 6f 20 70 72 65 64 69 63 | 74 20 77 68 61 74 20 77 |o predic|t what w|
|00005420| 69 6c 6c 20 68 61 70 70 | 65 6e 20 77 68 65 6e 20 |ill happ|en when |
|00005430| 61 20 70 72 6f 67 72 61 | 6d 20 75 73 65 73 20 6e |a progra|m uses n|
|00005440| 69 6c 20 70 6f 69 6e 74 | 65 72 73 2e 20 20 50 72 |il point|ers. Pr|
|00005450| 6f 67 72 61 6d 73 20 6d | 61 79 20 6e 6f 74 20 63 |ograms m|ay not c|
|00005460| 72 61 73 68 20 61 73 20 | 61 20 72 65 73 75 6c 74 |rash as |a result|
|00005470| 20 6f 66 20 75 73 69 6e | 67 20 61 20 6e 69 6c 20 | of usin|g a nil |
|00005480| 70 6f 69 6e 74 65 72 2c | 20 61 6e 64 20 74 68 65 |pointer,| and the|
|00005490| 79 20 6d 61 79 20 62 65 | 68 61 76 65 20 69 6e 20 |y may be|have in |
|000054a0| 61 20 63 6f 6e 73 69 73 | 74 65 6e 74 20 66 61 73 |a consis|tent fas|
|000054b0| 68 69 6f 6e 2e 20 20 54 | 68 69 73 20 64 6f 65 73 |hion. T|his does|
|000054c0| 20 6e 6f 74 20 6d 65 61 | 6e 20 74 68 61 74 20 74 | not mea|n that t|
|000054d0| 68 65 72 65 20 69 73 6e | d5 74 20 61 20 62 75 67 |here isn|.t a bug|
|000054e0| 2e 20 20 54 68 69 73 20 | 6d 65 72 65 6c 79 20 6d |. This |merely m|
|000054f0| 65 61 6e 73 20 74 68 61 | 74 20 74 68 65 20 70 72 |eans tha|t the pr|
|00005500| 6f 67 72 61 6d 20 69 73 | 20 6c 75 63 6b 79 2c 20 |ogram is| lucky, |
|00005510| 61 6e 64 20 74 68 61 74 | 20 69 74 20 73 68 6f 75 |and that| it shou|
|00005520| 6c 64 20 62 65 20 70 6c | 61 79 69 6e 67 20 74 68 |ld be pl|aying th|
|00005530| 65 20 6c 6f 74 74 65 72 | 79 2c 20 6e 6f 74 20 72 |e lotter|y, not r|
|00005540| 75 6e 6e 69 6e 67 20 6f | 6e 20 61 20 4d 61 63 69 |unning o|n a Maci|
|00005550| 6e 74 6f 73 68 2e 20 20 | 49 66 20 61 20 70 72 6f |ntosh. |If a pro|
|00005560| 67 72 61 6d 20 61 63 74 | 73 20 64 69 66 66 65 72 |gram act|s differ|
|00005570| 65 6e 74 6c 79 20 6f 6e | 20 64 69 66 66 65 72 65 |ently on| differe|
|00005580| 6e 74 20 76 65 72 73 69 | 6f 6e 73 20 6f 66 20 74 |nt versi|ons of t|
|00005590| 68 65 20 4d 61 63 69 6e | 74 6f 73 68 2c 20 79 6f |he Macin|tosh, yo|
|000055a0| 75 20 73 68 6f 75 6c 64 | 20 74 68 69 6e 6b 20 d2 |u should| think .|
|000055b0| 63 6f 75 6c 64 20 74 68 | 65 72 65 20 62 65 20 61 |could th|ere be a|
|000055c0| 20 6e 61 73 74 79 20 6e | 69 6c 20 70 6f 69 6e 74 | nasty n|il point|
|000055d0| 65 72 20 70 72 6f 62 6c | 65 6d 20 68 65 72 65 3f |er probl|em here?|
|000055e0| d3 20 20 20 55 73 65 20 | 6f 66 20 61 20 6e 69 6c |. Use |of a nil|
|000055f0| 20 68 61 6e 64 6c 65 20 | 75 73 75 61 6c 6c 79 20 | handle |usually |
|00005600| 63 75 6c 6d 69 6e 61 74 | 65 73 20 69 6e 20 72 65 |culminat|es in re|
|00005610| 61 64 69 6e 67 20 6f 72 | 20 77 72 69 74 69 6e 67 |ading or| writing|
|00005620| 20 74 6f 20 6f 62 73 63 | 75 72 65 20 70 6c 61 63 | to obsc|ure plac|
|00005630| 65 73 20 69 6e 20 6d 65 | 6d 6f 72 79 2e 20 20 41 |es in me|mory. A|
|00005640| 73 20 61 6e 20 65 78 61 | 6d 70 6c 65 3a 0d 09 56 |s an exa|mple:..V|
|00005650| 41 52 20 20 20 6d 79 48 | 61 6e 64 6c 65 3a 20 20 |AR myH|andle: |
|00005660| 54 45 48 61 6e 64 6c 65 | 3b 0d 09 6d 79 48 61 6e |TEHandle|;..myHan|
|00005670| 64 6c 65 20 3a 3d 20 6e | 69 6c 3b 0d 54 68 61 74 |dle := n|il;.That|
|00005680| d5 73 20 70 72 65 74 74 | 79 20 73 74 72 61 69 67 |.s prett|y straig|
|00005690| 68 74 66 6f 72 77 61 72 | 64 2c 20 73 6f 20 77 68 |htforwar|d, so wh|
|000056a0| 61 74 d5 73 20 74 68 65 | 20 70 72 6f 62 6c 65 6d |at.s the| problem|
|000056b0| 3f 20 20 49 66 20 79 6f | 75 20 64 6f 20 73 6f 6d |? If yo|u do som|
|000056c0| 65 74 68 69 6e 67 20 6c | 69 6b 65 3a 0d 09 6d 79 |ething l|ike:..my|
|000056d0| 48 61 6e 64 6c 65 5e 5e | 2e 76 69 65 77 52 65 63 |Handle^^|.viewRec|
|000056e0| 74 20 3a 3d 20 6d 79 52 | 65 63 74 3b 20 20 7b 20 |t := myR|ect; { |
|000056f0| 76 65 72 79 20 62 61 64 | 20 69 64 65 61 20 77 69 |very bad| idea wi|
|00005700| 74 68 20 6d 79 48 61 6e | 64 6c 65 20 3d 20 6e 69 |th myHan|dle = ni|
|00005710| 6c 20 7d 0d 6d 65 6d 6f | 72 79 20 6c 6f 63 61 74 |l }.memo|ry locat|
|00005720| 69 6f 6e 20 7a 65 72 6f | 20 77 69 6c 6c 20 62 65 |ion zero| will be|
|00005730| 20 75 73 65 64 20 61 73 | 20 61 20 70 6f 69 6e 74 | used as| a point|
|00005740| 65 72 20 74 6f 20 67 69 | 76 65 20 74 68 65 20 61 |er to gi|ve the a|
|00005750| 64 64 72 65 73 73 20 6f | 66 20 61 20 54 65 78 74 |ddress o|f a Text|
|00005760| 45 64 69 74 20 72 65 63 | 6f 72 64 2e 20 20 57 68 |Edit rec|ord. Wh|
|00005770| 61 74 20 69 66 20 74 68 | 61 74 20 6d 65 6d 6f 72 |at if th|at memor|
|00005780| 79 20 6c 6f 63 61 74 69 | 6f 6e 20 70 6f 69 6e 74 |y locati|on point|
|00005790| 73 20 74 6f 20 73 6f 6d | 65 74 68 69 6e 67 20 69 |s to som|ething i|
|000057a0| 6e 20 74 68 65 20 73 79 | 73 74 65 6d 20 68 65 61 |n the sy|stem hea|
|000057b0| 70 3f 20 20 57 68 61 74 | 20 69 66 20 69 74 20 70 |p? What| if it p|
|000057c0| 6f 69 6e 74 73 20 74 6f | 20 74 68 65 20 73 6f 75 |oints to| the sou|
|000057d0| 6e 64 20 62 75 66 66 65 | 72 3f 20 20 49 6e 20 63 |nd buffe|r? In c|
|000057e0| 61 73 65 73 20 6c 69 6b | 65 20 74 68 65 73 65 2c |ases lik|e these,|
|000057f0| 20 65 69 67 68 74 20 62 | 79 74 65 73 20 6f 66 20 | eight b|ytes of |
|00005800| 72 65 63 74 61 6e 67 6c | 65 20 64 61 74 61 20 77 |rectangl|e data w|
|00005810| 69 6c 6c 20 62 65 20 77 | 72 69 74 74 65 6e 20 74 |ill be w|ritten t|
|00005820| 6f 20 77 68 65 72 65 76 | 65 72 20 6d 65 6d 6f 72 |o wherev|er memor|
|00005830| 79 20 6c 6f 63 61 74 69 | 6f 6e 20 30 20 70 6f 69 |y locati|on 0 poi|
|00005840| 6e 74 73 2e 20 20 0d 55 | 73 65 20 6f 66 20 61 20 |nts. .U|se of a |
|00005850| 6e 69 6c 20 68 61 6e 64 | 6c 65 20 77 69 6c 6c 20 |nil hand|le will |
|00005860| 6e 65 76 65 72 20 62 65 | 20 75 73 65 66 75 6c 2e |never be| useful.|
|00005870| 20 20 54 68 69 73 20 6d | 65 6d 6f 72 79 20 69 73 | This m|emory is|
|00005880| 20 72 65 73 65 72 76 65 | 64 20 61 6e 64 20 75 73 | reserve|d and us|
|00005890| 65 64 20 62 79 20 74 68 | 65 20 36 38 30 30 30 20 |ed by th|e 68000 |
|000058a0| 66 6f 72 20 76 61 72 69 | 6f 75 73 20 69 6e 74 65 |for vari|ous inte|
|000058b0| 72 72 75 70 74 20 76 65 | 63 74 6f 72 73 20 61 6e |rrupt ve|ctors an|
|000058c0| 64 20 56 61 6c 75 61 62 | 6c 65 20 53 74 75 66 66 |d Valuab|le Stuff|
|000058d0| 2e 20 20 54 68 69 73 20 | 56 61 6c 75 61 62 6c 65 |. This |Valuable|
|000058e0| 20 53 74 75 66 66 20 69 | 73 20 63 6f 6d 70 6f 73 | Stuff i|s compos|
|000058f0| 65 64 20 6f 66 20 74 68 | 69 6e 67 73 20 74 68 61 |ed of th|ings tha|
|00005900| 74 20 79 6f 75 20 64 65 | 66 69 6e 69 74 65 6c 79 |t you de|finitely|
|00005910| 20 64 6f 20 6e 6f 74 20 | 77 61 6e 74 20 74 6f 20 | do not |want to |
|00005920| 63 68 61 6e 67 65 2e 20 | 20 57 68 65 6e 20 63 68 |change. | When ch|
|00005930| 61 6e 67 65 64 2c 20 74 | 68 65 20 36 38 30 30 30 |anged, t|he 68000|
|00005940| 20 66 69 6e 64 73 20 6f | 75 74 2c 20 61 6e 64 20 | finds o|ut, and |
|00005950| 64 65 63 69 64 65 73 20 | 74 6f 20 67 65 74 20 62 |decides |to get b|
|00005960| 61 63 6b 20 61 74 20 79 | 6f 75 72 20 70 72 6f 67 |ack at y|our prog|
|00005970| 72 61 6d 20 69 6e 20 74 | 68 65 20 6d 6f 73 74 20 |ram in t|he most |
|00005980| 73 74 72 61 6e 67 65 20 | 61 6e 64 20 77 6f 6e 64 |strange |and wond|
|00005990| 65 72 66 75 6c 20 77 61 | 79 73 2e 20 20 54 68 65 |erful wa|ys. The|
|000059a0| 73 65 20 73 74 72 61 6e | 67 65 20 72 65 73 75 6c |se stran|ge resul|
|000059b0| 74 73 20 63 61 6e 20 72 | 61 6e 67 65 20 66 72 6f |ts can r|ange fro|
|000059c0| 6d 20 61 20 53 79 73 74 | 65 6d 20 45 72 72 6f 72 |m a Syst|em Error|
|000059d0| 20 61 6c 6c 20 74 68 65 | 20 77 61 79 20 74 6f 20 | all the| way to |
|000059e0| 65 72 61 73 69 6e 67 20 | 68 61 72 64 20 64 69 73 |erasing |hard dis|
|000059f0| 6b 73 20 61 6e 64 20 64 | 65 73 74 72 6f 79 69 6e |ks and d|estroyin|
|00005a00| 67 20 66 69 6c 65 73 2e | 20 20 54 68 65 72 65 20 |g files.| There |
|00005a10| 72 65 61 6c 6c 79 20 69 | 73 20 6e 6f 20 6c 69 6d |really i|s no lim|
|00005a20| 69 74 20 74 6f 20 74 68 | 65 20 68 61 76 6f 63 20 |it to th|e havoc |
|00005a30| 74 68 61 74 20 63 61 6e | 20 62 65 20 77 72 65 61 |that can| be wrea|
|00005a40| 6b 65 64 2e 20 20 54 68 | 69 73 20 74 65 6e 64 73 |ked. Th|is tends|
|00005a50| 20 74 6f 20 6b 65 65 70 | 20 74 68 65 20 75 73 65 | to keep| the use|
|00005a60| 72 73 20 6f 6e 20 74 68 | 65 20 65 64 67 65 20 6f |rs on th|e edge o|
|00005a70| 66 20 74 68 65 69 72 20 | 73 65 61 74 2c 20 62 75 |f their |seat, bu|
|00005a80| 74 20 74 68 69 73 20 69 | 73 20 6e 6f 74 20 72 65 |t this i|s not re|
|00005a90| 61 6c 6c 79 20 74 68 65 | 20 64 65 73 69 72 65 64 |ally the| desired|
|00005aa0| 20 65 66 66 65 63 74 2e | 20 20 41 73 20 6e 6f 74 | effect.| As not|
|00005ab0| 65 64 20 61 62 6f 76 65 | 2c 20 69 74 20 77 6f 6e |ed above|, it won|
|00005ac0| d5 74 20 6e 65 63 65 73 | 73 61 72 69 6c 79 20 63 |.t neces|sarily c|
|00005ad0| 61 75 73 65 20 74 72 61 | 75 6d 61 74 69 63 20 72 |ause tra|umatic r|
|00005ae0| 65 73 75 6c 74 73 2e 20 | 20 41 20 70 72 6f 67 72 |esults. | A progr|
|00005af0| 61 6d 20 63 61 6e 20 62 | 65 20 64 6f 69 6e 67 20 |am can b|e doing |
|00005b00| 6e 61 75 67 68 74 79 20 | 74 68 69 6e 67 73 20 61 |naughty |things a|
|00005b10| 6e 64 20 6e 6f 74 20 67 | 65 74 20 63 61 75 67 68 |nd not g|et caugh|
|00005b20| 74 2e 20 20 54 68 69 73 | 20 69 73 20 73 74 69 6c |t. This| is stil|
|00005b30| 6c 20 61 20 62 75 67 20 | 74 68 61 74 20 6e 65 65 |l a bug |that nee|
|00005b40| 64 73 20 74 6f 20 62 65 | 20 66 69 78 65 64 2c 20 |ds to be| fixed, |
|00005b50| 73 69 6e 63 65 20 69 74 | 20 69 73 20 6e 65 61 72 |since it| is near|
|00005b60| 6c 79 20 67 75 61 72 61 | 6e 74 65 65 64 20 74 6f |ly guara|nteed to|
|00005b70| 20 67 69 76 65 20 64 69 | 66 66 65 72 65 6e 74 20 | give di|fferent |
|00005b80| 72 65 73 75 6c 74 73 20 | 6f 6e 20 64 69 66 66 65 |results |on diffe|
|00005b90| 72 65 6e 74 20 76 65 72 | 73 69 6f 6e 73 20 6f 66 |rent ver|sions of|
|00005ba0| 20 74 68 65 20 4d 61 63 | 69 6e 74 6f 73 68 2e 20 | the Mac|intosh. |
|00005bb0| 20 50 72 6f 67 72 61 6d | 73 20 65 78 68 69 62 69 | Program|s exhibi|
|00005bc0| 74 69 6e 67 20 73 63 68 | 69 7a 6f 70 68 72 65 6e |ting sch|izophren|
|00005bd0| 69 61 20 68 61 76 65 20 | 62 65 65 6e 20 70 72 6f |ia have |been pro|
|00005be0| 76 65 6e 20 74 6f 20 62 | 65 20 6c 65 73 73 20 65 |ven to b|e less e|
|00005bf0| 6e 6a 6f 79 61 62 6c 65 | 20 74 6f 20 75 73 65 2e |njoyable| to use.|
|00005c00| 0d 48 6f 77 20 74 6f 20 | 61 76 6f 69 64 20 62 65 |.How to |avoid be|
|00005c10| 69 6e 67 20 61 20 4e 69 | 6c 6c 65 72 0d 57 68 65 |ing a Ni|ller.Whe|
|00005c20| 6e 65 76 65 72 20 61 20 | 70 72 6f 67 72 61 6d 20 |never a |program |
|00005c30| 75 73 65 73 20 70 6f 69 | 6e 74 65 72 73 20 61 6e |uses poi|nters an|
|00005c40| 64 20 68 61 6e 64 6c 65 | 73 2c 20 69 74 20 73 68 |d handle|s, it sh|
|00005c50| 6f 75 6c 64 20 65 6e 73 | 75 72 65 20 74 68 61 74 |ould ens|ure that|
|00005c60| 20 74 68 65 20 70 6f 69 | 6e 74 65 72 20 6f 72 20 | the poi|nter or |
|00005c70| 68 61 6e 64 6c 65 20 77 | 69 6c 6c 20 6e 6f 74 20 |handle w|ill not |
|00005c80| 62 65 20 6e 69 6c 2e 20 | 20 54 68 69 73 20 63 6f |be nil. | This co|
|00005c90| 75 6c 64 20 62 65 20 74 | 65 72 6d 65 64 20 64 65 |uld be t|ermed de|
|00005ca0| 66 65 6e 73 69 76 65 20 | 70 72 6f 67 72 61 6d 6d |fensive |programm|
|00005cb0| 69 6e 67 2c 20 73 69 6e | 63 65 20 69 74 20 61 73 |ing, sin|ce it as|
|00005cc0| 73 75 6d 65 73 20 74 68 | 61 74 20 65 76 65 72 79 |sumes th|at every|
|00005cd0| 6f 6e 65 20 69 73 20 6f | 75 74 20 74 6f 20 67 65 |one is o|ut to ge|
|00005ce0| 74 20 74 68 65 20 70 72 | 6f 67 72 61 6d 20 28 77 |t the pr|ogram (w|
|00005cf0| 68 69 63 68 20 69 73 20 | 6e 6f 74 20 66 61 72 20 |hich is |not far |
|00005d00| 66 72 6f 6d 20 74 68 65 | 20 74 72 75 74 68 20 6f |from the| truth o|
|00005d10| 6e 20 74 68 65 20 4d 61 | 63 69 6e 74 6f 73 68 29 |n the Ma|cintosh)|
|00005d20| 2e 20 20 59 6f 75 20 73 | 68 6f 75 6c 64 20 61 6c |. You s|hould al|
|00005d30| 77 61 79 73 20 63 68 65 | 63 6b 20 74 68 65 20 72 |ways che|ck the r|
|00005d40| 65 73 75 6c 74 20 6f 66 | 20 72 6f 75 74 69 6e 65 |esult of| routine|
|00005d50| 73 20 74 68 61 74 20 63 | 6c 61 69 6d 20 74 6f 20 |s that c|laim to |
|00005d60| 70 61 73 73 20 62 61 63 | 6b 20 61 20 68 61 6e 64 |pass bac|k a hand|
|00005d70| 6c 65 2e 20 49 66 20 74 | 68 65 79 20 70 61 73 73 |le. If t|hey pass|
|00005d80| 20 79 6f 75 20 62 61 63 | 6b 20 61 20 6e 69 6c 20 | you bac|k a nil |
|00005d90| 68 61 6e 64 6c 65 2c 20 | 79 6f 75 20 63 6f 75 6c |handle, |you coul|
|00005da0| 64 20 67 65 74 20 69 6e | 20 74 72 6f 75 62 6c 65 |d get in| trouble|
|00005db0| 20 69 66 20 79 6f 75 20 | 75 73 65 20 74 68 65 6d | if you |use them|
|00005dc0| 2e 20 20 44 6f 6e d5 74 | 20 74 72 75 73 74 20 74 |. Don.t| trust t|
|00005dd0| 68 65 20 52 4f 4d 2e 20 | 20 54 68 65 20 66 6f 6c |he ROM. | The fol|
|00005de0| 6c 6f 77 69 6e 67 20 65 | 78 61 6d 70 6c 65 20 6f |lowing e|xample o|
|00005df0| 66 20 61 20 64 65 66 65 | 6e 73 69 76 65 20 75 73 |f a defe|nsive us|
|00005e00| 65 20 6f 66 20 61 20 68 | 61 6e 64 6c 65 20 69 6e |e of a h|andle in|
|00005e10| 76 6f 6c 76 65 73 20 74 | 68 65 20 52 65 73 6f 75 |volves t|he Resou|
|00005e20| 72 63 65 20 4d 61 6e 61 | 67 65 72 2e 20 20 54 68 |rce Mana|ger. Th|
|00005e30| 65 20 52 65 73 6f 75 72 | 63 65 20 4d 61 6e 61 67 |e Resour|ce Manag|
|00005e40| 65 72 20 70 61 73 73 65 | 73 20 62 61 63 6b 20 61 |er passe|s back a|
|00005e50| 20 68 61 6e 64 6c 65 20 | 74 6f 20 74 68 65 20 72 | handle |to the r|
|00005e60| 65 73 6f 75 72 63 65 20 | 64 61 74 61 2e 20 20 54 |esource |data. T|
|00005e70| 68 65 72 65 20 61 72 65 | 20 61 6e 79 20 6e 75 6d |here are| any num|
|00005e80| 62 65 72 20 6f 66 20 70 | 6c 61 63 65 73 20 77 68 |ber of p|laces wh|
|00005e90| 65 72 65 20 69 74 20 6d | 61 79 20 62 65 20 66 6f |ere it m|ay be fo|
|00005ea0| 72 63 65 64 20 74 6f 20 | 70 61 73 73 20 62 61 63 |rced to |pass bac|
|00005eb0| 6b 20 61 20 6e 69 6c 20 | 68 61 6e 64 6c 65 2e 20 |k a nil |handle. |
|00005ec0| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 3a 0d 09 0d | For exa|mple:...|
|00005ed0| 09 56 41 52 20 20 20 6d | 79 52 65 7a 7a 69 65 3a |.VAR m|yRezzie:|
|00005ee0| 20 20 4d 79 48 61 6e 64 | 6c 65 3b 0d 09 6d 79 52 | MyHand|le;..myR|
|00005ef0| 65 7a 7a 69 65 20 3a 3d | 20 4d 79 48 61 6e 64 6c |ezzie :=| MyHandl|
|00005f00| 65 28 47 65 74 52 65 73 | 6f 75 72 63 65 28 6d 79 |e(GetRes|ource(my|
|00005f10| 52 65 73 54 79 70 65 2c | 20 6d 79 52 65 73 4e 75 |ResType,| myResNu|
|00005f20| 6d 62 65 72 29 29 3b 09 | 7b 20 63 6f 75 6c 64 20 |mber));.|{ could |
|00005f30| 62 65 20 6d 69 73 73 69 | 6e 67 c9 7d 0d 09 49 46 |be missi|ng.}..IF|
|00005f40| 20 6d 79 52 65 7a 7a 69 | 65 20 3d 20 6e 69 6c 20 | myRezzi|e = nil |
|00005f50| 20 54 48 45 4e 20 20 45 | 72 72 6f 72 48 61 6e 64 | THEN E|rrorHand|
|00005f60| 6c 65 72 28 27 57 65 20 | 61 6c 6d 6f 73 74 20 67 |ler('We |almost g|
|00005f70| 6f 74 20 4e 69 6c 6c 65 | 64 27 29 0d 09 45 4c 53 |ot Nille|d')..ELS|
|00005f80| 45 20 20 6d 79 52 65 7a | 7a 69 65 5e 5e 2e 6d 79 |E myRez|zie^^.my|
|00005f90| 52 65 63 74 20 3a 3d 20 | 6e 65 77 52 65 63 74 3b |Rect := |newRect;|
|00005fa0| 20 20 09 20 7b 20 57 65 | 20 6b 6e 6f 77 20 69 74 | . { We| know it|
|00005fb0| 20 69 73 20 4f 4b 20 7d | 0d 41 73 20 61 6e 6f 74 | is OK }|.As anot|
|00005fc0| 68 65 72 20 65 78 61 6d | 70 6c 65 2c 20 74 68 69 |her exam|ple, thi|
|00005fd0| 6e 6b 20 6f 66 20 68 6f | 77 20 68 61 6e 64 6c 65 |nk of ho|w handle|
|00005fe0| 73 20 63 61 6e 20 62 65 | 20 70 75 72 67 65 64 20 |s can be| purged |
|00005ff0| 66 72 6f 6d 20 6d 65 6d | 6f 72 79 20 69 6e 20 74 |from mem|ory in t|
|00006000| 69 67 68 74 20 6d 65 6d | 6f 72 79 20 63 6f 6e 64 |ight mem|ory cond|
|00006010| 69 74 69 6f 6e 73 2e 20 | 20 49 66 20 61 20 62 6c |itions. | If a bl|
|00006020| 6f 63 6b 20 69 73 20 6d | 61 72 6b 65 64 20 70 75 |ock is m|arked pu|
|00006030| 72 67 65 61 62 6c 65 2c | 20 74 68 65 20 4d 65 6d |rgeable,| the Mem|
|00006040| 6f 72 79 20 4d 61 6e 61 | 67 65 72 20 6d 61 79 20 |ory Mana|ger may |
|00006050| 74 68 72 6f 77 20 69 74 | 20 61 77 61 79 20 61 74 |throw it| away at|
|00006060| 20 61 6e 79 20 74 69 6d | 65 2e 20 20 54 68 69 73 | any tim|e. This|
|00006070| 20 63 72 65 61 74 65 73 | 20 61 6e 20 65 6d 70 74 | creates| an empt|
|00006080| 79 20 68 61 6e 64 6c 65 | 2e 20 20 54 68 65 20 64 |y handle|. The d|
|00006090| 65 66 65 6e 73 69 76 65 | 20 70 72 6f 67 72 61 6d |efensive| program|
|000060a0| 6d 65 72 20 77 69 6c 6c | 20 61 6c 77 61 79 73 20 |mer will| always |
|000060b0| 6d 61 6b 65 20 73 75 72 | 65 20 74 68 61 74 20 74 |make sur|e that t|
|000060c0| 68 65 20 68 61 6e 64 6c | 65 73 20 62 65 69 6e 67 |he handl|es being|
|000060d0| 20 75 73 65 64 20 61 72 | 65 20 6e 6f 74 20 65 6d | used ar|e not em|
|000060e0| 70 74 79 2e 20 20 0d 09 | 56 41 52 20 20 20 6d 79 |pty. ..|VAR my|
|000060f0| 52 65 7a 7a 69 65 3a 20 | 20 6d 79 48 61 6e 64 6c |Rezzie: | myHandl|
|00006100| 65 3b 0d 09 6d 79 52 65 | 7a 7a 69 65 20 3a 3d 20 |e;..myRe|zzie := |
|00006110| 6d 79 48 61 6e 64 6c 65 | 28 47 65 74 52 65 73 6f |myHandle|(GetReso|
|00006120| 75 72 63 65 28 6d 79 52 | 65 73 54 79 70 65 2c 20 |urce(myR|esType, |
|00006130| 6d 79 52 65 73 4e 75 6d | 62 65 72 29 29 3b 20 20 |myResNum|ber)); |
|00006140| 7b 20 63 6f 75 6c 64 20 | 62 65 20 09 09 09 09 20 |{ could |be .... |
|00006150| 20 20 20 20 20 20 20 20 | 20 6d 69 73 73 69 6e 67 | | missing|
|00006160| c9 20 7d 0d 09 49 46 20 | 6d 79 52 65 7a 7a 69 65 |. }..IF |myRezzie|
|00006170| 20 3d 20 6e 69 6c 20 20 | 54 48 45 4e 20 20 45 72 | = nil |THEN Er|
|00006180| 72 6f 72 48 61 6e 64 6c | 65 72 28 27 57 65 20 61 |rorHandl|er('We a|
|00006190| 6c 6d 6f 73 74 20 67 6f | 74 20 4e 69 6c 6c 65 64 |lmost go|t Nilled|
|000061a0| 27 29 0d 09 45 4c 53 45 | 20 20 6d 79 52 65 7a 7a |')..ELSE| myRezz|
|000061b0| 69 65 5e 5e 2e 6d 79 52 | 65 63 74 20 3a 3d 20 6e |ie^^.myR|ect := n|
|000061c0| 65 77 52 65 63 74 3b 09 | 7b 20 57 65 20 6b 6e 6f |ewRect;.|{ We kno|
|000061d0| 77 20 69 74 20 69 73 20 | 4f 4b 20 7d 0d 09 74 65 |w it is |OK }..te|
|000061e0| 6d 70 48 61 6e 64 6c 65 | 20 3a 3d 20 4e 65 77 48 |mpHandle| := NewH|
|000061f0| 61 6e 64 6c 65 20 28 6c | 61 72 67 65 42 6c 6f 63 |andle (l|argeBloc|
|00006200| 6b 29 3b 09 7b 6d 69 67 | 68 74 20 64 69 73 70 6f |k);.{mig|ht dispo|
|00006210| 73 65 20 61 20 70 75 72 | 67 65 61 62 6c 65 20 6d |se a pur|geable m|
|00006220| 79 52 65 7a 7a 69 65 7d | 0d 09 49 46 20 6d 79 52 |yRezzie}|..IF myR|
|00006230| 65 7a 7a 69 65 5e 20 3d | 20 6e 69 6c 20 20 54 48 |ezzie^ =| nil TH|
|00006240| 45 4e 20 4c 6f 61 64 52 | 65 73 6f 75 72 63 65 28 |EN LoadR|esource(|
|00006250| 48 61 6e 64 6c 65 28 6d | 79 52 65 7a 7a 69 65 29 |Handle(m|yRezzie)|
|00006260| 29 3b 20 7b 52 65 2d 6c | 6f 61 64 20 65 6d 70 74 |); {Re-l|oad empt|
|00006270| 79 09 09 09 09 20 20 20 | 20 20 20 20 20 68 61 6e |y.... | han|
|00006280| 64 6c 65 7d 0d 09 49 46 | 20 52 65 73 45 72 72 6f |dle}..IF| ResErro|
|00006290| 72 20 3d 20 6e 6f 45 72 | 72 20 20 54 48 45 4e 20 |r = noEr|r THEN |
|000062a0| 0d 09 20 20 20 20 6d 79 | 52 65 7a 7a 69 65 5e 5e |.. my|Rezzie^^|
|000062b0| 2e 53 74 61 74 75 73 46 | 69 65 6c 64 20 3a 3d 20 |.StatusF|ield := |
|000062c0| 4f 4b 3b 09 7b 20 67 75 | 61 72 61 6e 74 65 65 64 |OK;.{ gu|aranteed|
|000062d0| 20 6e 6f 74 20 65 6d 70 | 74 79 2c 20 61 6e 64 20 | not emp|ty, and |
|000062e0| 61 63 74 75 61 6c 6c 79 | 20 09 09 09 67 65 74 73 |actually| ...gets|
|000062f0| 20 72 65 61 64 20 62 61 | 63 6b 20 69 6e 2c 20 69 | read ba|ck in, i|
|00006300| 66 20 6e 65 63 65 73 73 | 61 72 79 20 7d 0d 42 65 |f necess|ary }.Be|
|00006310| 20 65 73 70 65 63 69 61 | 6c 6c 79 20 63 61 72 65 | especia|lly care|
|00006320| 66 75 6c 20 6f 66 20 70 | 6c 61 63 65 73 20 77 68 |ful of p|laces wh|
|00006330| 65 72 65 20 6d 65 6d 6f | 72 79 20 69 73 20 62 65 |ere memo|ry is be|
|00006340| 69 6e 67 20 61 6c 6c 6f | 63 61 74 65 64 2e 20 20 |ing allo|cated. |
|00006350| 54 68 65 20 4e 65 77 48 | 61 6e 64 6c 65 20 61 6e |The NewH|andle an|
|00006360| 64 20 4e 65 77 50 74 72 | 20 63 61 6c 6c 73 20 77 |d NewPtr| calls w|
|00006370| 69 6c 6c 20 72 65 74 75 | 72 6e 20 61 20 6e 69 6c |ill retu|rn a nil|
|00006380| 20 68 61 6e 64 6c 65 20 | 6f 72 20 70 6f 69 6e 74 | handle |or point|
|00006390| 65 72 20 69 66 20 74 68 | 65 72 65 20 69 73 20 6e |er if th|ere is n|
|000063a0| 6f 74 20 65 6e 6f 75 67 | 68 20 6d 65 6d 6f 72 79 |ot enoug|h memory|
|000063b0| 2e 20 20 49 66 20 79 6f | 75 20 75 73 65 20 74 68 |. If yo|u use th|
|000063c0| 61 74 20 68 61 6e 64 6c | 65 20 6f 72 20 70 6f 69 |at handl|e or poi|
|000063d0| 6e 74 65 72 20 77 69 74 | 68 6f 75 74 20 63 68 65 |nter wit|hout che|
|000063e0| 63 6b 69 6e 67 2c 20 79 | 6f 75 20 77 69 6c 6c 20 |cking, y|ou will |
|000063f0| 62 65 20 67 75 69 6c 74 | 79 20 6f 66 20 62 65 69 |be guilt|y of bei|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.